function patterns_list in Patterns 7.2
Same name and namespace in other branches
- 5 patterns.module \patterns_list()
- 6.2 patterns.module \patterns_list()
- 6 patterns.module \patterns_list()
- 7 patterns.module \patterns_list()
First function to be called for displaying the pattern list page.
1 string reference to 'patterns_list'
- patterns_menu in ./
patterns.module - Implements hook_menu().
File
- ./
patterns.module, line 305
Code
function patterns_list() {
$form = array();
if (!patterns_engine_is_on()) {
$settings = l(t('settings'), 'admin/patterns/settings');
drupal_set_message(check_plain(t('Patterns engine is off. You can change the state of the engine from the !settings page.', array(
'!settings' => $settings,
))), 'warning');
}
if (!patterns_parser_ready()) {
$messages = t('No available patterns parser was found.</br>');
$messages .= t('Go to the !modules page to enable more Patterns parsers.', array(
'!modules' => l(t('modules'), 'admin/modules'),
));
drupal_set_message(check_plain($messages), 'warning');
}
drupal_add_js('misc/ajax.js');
drupal_add_css(drupal_get_path('module', 'patterns') . '/css/patterns.css');
drupal_add_js(drupal_get_path('module', 'patterns') . '/js/patterns.js');
$form['commands'] = array(
'#type' => 'fieldset',
'#title' => 'Commands',
);
$form['commands']['refresh'] = array(
'#type' => 'button',
'#value' => t('Refresh All'),
'#attributes' => array(
'style' => 'float:right',
'id' => 'refresh-all',
),
);
$form['commands']['create'] = array(
'#type' => 'button',
'#value' => t('Create New'),
'#attributes' => array(
'style' => 'float:right',
),
'#prefix' => '<a href="' . url('admin/patterns/import') . '">',
'#suffix' => '</a>',
);
if (patterns_engine_is_on()) {
$form['commands']['quickrun'] = array(
'#type' => 'button',
'#value' => t('Quick Run'),
'#attributes' => array(
'style' => 'float:right',
),
'#prefix' => '<a href="' . url('admin/patterns/quickrun') . '">',
'#suffix' => '</a>',
);
}
$output = drupal_render($form);
// Load the the pattern handlers from compontents directory
// or from modules which implement hook_patterns().
if (variable_get('patterns_refresh_components', TRUE)) {
patterns_io_load_components();
}
// Load the patterns from database.
$patterns = patterns_io_get_patterns(variable_get('patterns_refresh_from_fs', TRUE));
$output .= theme('patterns_list', $patterns);
return $output;
}