function list_form(&$form, &$form_state) { ctools_include('plugins', 'panels'); $this->layouts = panels_get_layouts(); parent::list_form($form, $form_state); $categories = $layouts = array('all' => t('- All -')); foreach ($this->items as $item) { $categories[$item->category] = $item->category ? $item->category : t('Mini panels'); } $form['top row']['category'] = array( '#type' => 'select', '#title' => t('Category'), '#options' => $categories, '#default_value' => 'all', '#weight' => -10, ); foreach ($this->layouts as $name => $plugin) { $layouts[$name] = $plugin['title']; } $form['top row']['layout'] = array( '#type' => 'select', '#title' => t('Layout'), '#options' => $layouts, '#default_value' => 'all', '#weight' => -9, ); }
function list_form(&$form, &$form_state) { ctools_include('stylizer'); parent::list_form($form, $form_state); $all = array('all' => t('- All -')); if (empty($this->base_types)) { // Give a warning about the missing base styles. drupal_set_message($this->plugin['strings']['message']['missing base type'], 'warning'); } $types = $all; foreach ($this->base_types as $module => $info) { foreach ($info as $key => $base_type) { $types[$module . '-' . $key] = $base_type['title']; } } $form['top row']['type'] = array('#type' => 'select', '#title' => t('Type'), '#options' => $types, '#default_value' => 'all', '#weight' => -10, '#attributes' => array('class' => array('ctools-auto-submit'))); $plugins = ctools_get_style_bases(); $form_state['style_plugins'] = $plugins; $options = $all; // @todo base should use $module . '-' . $name foreach ($plugins as $name => $plugin) { $options[$name] = $plugin['title']; } $form['top row']['base'] = array('#type' => 'select', '#title' => t('Base'), '#options' => $all + $options, '#default_value' => 'all', '#weight' => -9, '#attributes' => array('class' => array('ctools-auto-submit'))); }
/** * Overrides ctools_export_ui::list_form(). * * Simplifies the form similar to how the Context module does it. */ function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $form['top row']['submit'] = $form['bottom row']['submit']; $form['top row']['reset'] = $form['bottom row']['reset']; $form['bottom row']['#access'] = FALSE; return; }
/** * Create the filter/sort form at the top of a list of exports. */ function list_form(&$form, &$form_state) { // Put a wrapper around the form so it can be hidden. Unsetting the form // rows or doing nothing here doesn't seem to do the trick. parent::list_form($form, $form_state); $form['#prefix'] = '<div class="finder-ui-list-wrapper">' . $form['#prefix']; $form['#suffix'] = $form['#prefix'] . '</div>'; }
/** * @todo */ function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $form['top row']['theme'] = array('#type' => 'select', '#title' => t('Theme'), '#options' => array('all' => t('- All -')) + _delta_ui_options_themes(), '#default_value' => 'all', '#weight' => -10); $form['top row']['submit'] = $form['bottom row']['submit']; $form['top row']['reset'] = $form['bottom row']['reset']; $form['bottom row']['#access'] = FALSE; }
function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $options = array('all' => t('- All -')); foreach ($this->items as $item) { $options[$item->category] = $item->category; } $form['top row']['category'] = array('#type' => 'select', '#title' => t('Category'), '#options' => $options, '#default_value' => 'all', '#weight' => -10); }
/** * Create the filter/sort form at the top of a list of exports. * * This handles the very default conditions, and most lists are expected * to override this and call through to parent::list_form() in order to * get the base form and then modify it as necessary to add search * gadgets for custom fields. */ public function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $form['top row'] += $form['bottom row']; $form['filters'] = array('#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => TRUE, '#title' => t('Filters')); $form['filters']['top row'] = $form['top row']; unset($form['bottom row']); unset($form['top row']); }
function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $form['top row']['submit'] = $form['bottom row']['submit']; $form['top row']['reset'] = $form['bottom row']['reset']; $form['bottom row']['#access'] = FALSE; // Invalidate the context cache. context_invalidate_cache(); return; }
/** * Modify the profile list form. */ function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $all = array('all' => t('- All -')); $form['top row']['storage']['#weight'] = -2; $form['top row']['disabled']['#weight'] = -1; $form['top row']['exposed'] = array('#type' => 'select', '#title' => t('Exposed'), '#options' => $all + array('0' => t('Hidden'), '1' => t('Exposed')), '#default_value' => 'all', '#weight' => 0); // Change default sort to Title. $form['bottom row']['sort']['#default_value'] = 'title'; }
function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); // Add a filter element for Category. $options = array('all' => t('- All -')); foreach ($this->items as $item) { if (!empty($item->category)) { $options[$item->category] = $item->category; } } $form['top row']['category'] = array('#type' => 'select', '#title' => t('Category'), '#options' => $options, '#default_value' => 'all', '#weight' => -10); $form['top row']['search']['#size'] = 20; }
function list_form(&$form, &$form_state) { $row_class = 'container-inline'; if (!variable_get('views_ui_show_listing_filters', FALSE)) { $row_class .= " element-invisible"; } views_include('admin'); parent::list_form($form, $form_state); // ctools only has two rows. We want four. // That's why we create our own structure. $form['bottom row']['submit']['#attributes']['class'][] = 'js-hide'; $form['first row'] = array('#prefix' => '<div class="' . $row_class . ' ctools-export-ui-row ctools-export-ui-first-row clearfix">', '#suffix' => '</div>', 'search' => $form['top row']['search'], 'submit' => $form['bottom row']['submit'], 'reset' => $form['bottom row']['reset']); $form['second row'] = array('#prefix' => '<div class="' . $row_class . ' ctools-export-ui-row ctools-export-ui-second-row clearfix">', '#suffix' => '</div>', 'storage' => $form['top row']['storage'], 'disabled' => $form['top row']['disabled']); $form['third row'] = array('#prefix' => '<div class="' . $row_class . ' ctools-export-ui-row ctools-export-ui-third-row clearfix element-hidden">', '#suffix' => '</div>', 'order' => $form['bottom row']['order'], 'sort' => $form['bottom row']['sort']); unset($form['top row']); unset($form['bottom row']); // Modify the look and contents of existing form elements. $form['second row']['storage']['#title'] = ''; $form['second row']['storage']['#options'] = array('all' => t('All storage'), t('Normal') => t('In database'), t('Default') => t('In code'), t('Overridden') => t('Database overriding code')); $form['second row']['disabled']['#title'] = ''; $form['second row']['disabled']['#options']['all'] = t('All status'); $form['third row']['sort']['#title'] = ''; // And finally, add our own. $this->bases = array(); foreach (views_fetch_base_tables() as $table => $info) { $this->bases[$table] = $info['title']; } $form['second row']['base'] = array('#type' => 'select', '#options' => array_merge(array('all' => t('All types')), $this->bases), '#default_value' => 'all', '#weight' => -1); $tags = array(); if (isset($form_state['object']->items)) { foreach ($form_state['object']->items as $name => $view) { if (!empty($view->tag)) { $view_tags = drupal_explode_tags($view->tag); foreach ($view_tags as $tag) { $tags[$tag] = $tag; } } } } asort($tags); $form['second row']['tag'] = array('#type' => 'select', '#title' => t('Filter'), '#options' => array_merge(array('all' => t('All tags')), array('none' => t('No tags')), $tags), '#default_value' => 'all', '#weight' => -9); $displays = array(); foreach (views_fetch_plugin_data('display') as $id => $info) { if (!empty($info['admin'])) { $displays[$id] = $info['admin']; } } asort($displays); $form['second row']['display'] = array('#type' => 'select', '#options' => array_merge(array('all' => t('All displays')), $displays), '#default_value' => 'all', '#weight' => -1); }
function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); // This is perhaps a bit brutal, but I don't think that any sites // will have enough premium levels to warrant the very fancy // filtering interface CTools provide by default. If you really need // this interface, please file a bug, and we will consider making an // option for enabling it. // TODO: This is really an ugly way to hide these, but pending // resolution of http://drupal.org/node/1133740, it seems to be the // best way to go. $form['top row']['#access'] = FALSE; $form['bottom row']['#access'] = FALSE; }
/** * Create the filter/sort form at the top of a list of exports. * * This handles the very default conditions, and most lists are expected * to override this and call through to parent::list_form() in order to * get the base form and then modify it as necessary to add search * gadgets for custom fields. */ public function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $class = _ultimate_cron_get_class('job'); $lock_ids = $class::isLockedMultiple($this->items); $log_entries = $class::loadLatestLogEntries($this->items); $progresses = $class::getProgressMultiple($this->items); foreach ($this->items as $name => $item) { $item->log_entry = isset($item->log_entry) ? $item->log_entry : $log_entries[$name]; $item->progress = isset($item->progress) ? $item->progress : $progresses[$name]; $item->lock_id = isset($item->lock_id) ? $item->lock_id : $lock_ids[$name]; } $form['#attached']['js'][] = drupal_get_path('module', 'ultimate_cron') . '/js/ultimate_cron.js'; if (module_exists('nodejs')) { $settings = _ultimate_cron_plugin_load('settings', 'general')->getDefaultSettings(); if (!empty($settings['nodejs'])) { nodejs_send_content_channel_token('ultimate_cron'); $form['#attached']['js'][] = drupal_get_path('module', 'ultimate_cron') . '/js/ultimate_cron.nodejs.js'; } } // There's no normal for Ultimate Cron! unset($form['top row']['storage']['#options'][t('Normal')]); $all = array('all' => t('- All -')); $options = $all + array('running' => 'running', -1 => 'no info') + watchdog_severity_levels(); $form['top row']['status'] = array('#type' => 'select', '#title' => t('Status'), '#options' => $options, '#default_value' => 'all', '#weight' => -2); $jobs = ultimate_cron_get_hooks(); $modules = array(); foreach ($jobs as $job) { $info = system_get_info('module', $job['module']); $modules[$job['module']] = $info && !empty($info['name']) ? $info['name'] : $job['module']; } $form['top row']['module'] = array('#type' => 'select', '#title' => t('Module'), '#options' => $all + $modules, '#default_value' => 'all', '#weight' => -1); $form['bottom row']['reload'] = array('#type' => 'submit', '#id' => 'ctools-export-ui-list-items-reload', '#value' => t('Reload'), '#attributes' => array('class' => array('use-ajax-submit'))); }
/** * Hide the top row of form items on the admin form. */ function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $form['top row'] = $form['top row'] + array('#access' => FALSE); }