You are here

public function stylizer_ui::list_filter in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 stylizer/plugins/export_ui/stylizer_ui.class.php \stylizer_ui::list_filter()

Determine if a row should be filtered out.

This handles the default filters for the export UI list form. If you added additional filters in list_form() then this is where you should handle them.

Return value

TRUE if the item should be excluded.

Overrides ctools_export_ui::list_filter

File

stylizer/plugins/export_ui/stylizer_ui.class.php, line 78

Class

stylizer_ui
UI class for Stylizer.

Code

public function list_filter($form_state, $item) {
  if (empty($form_state['style_plugins'][$item->settings['style_base']])) {
    $this->style_plugin = array(
      'name' => 'broken',
      'title' => t('Missing plugin'),
      'type' => t('Unknown'),
      'module' => '',
    );
  }
  else {
    $this->style_plugin = $form_state['style_plugins'][$item->settings['style_base']];
  }

  // This isn't really a field, but by setting this we can list it in the
  // filter fields and have the search box pick it up.
  $item->plugin_title = $this->style_plugin['title'];
  if ($form_state['values']['type'] != 'all') {
    list($module, $type) = explode('-', $form_state['values']['type']);
    if ($module != $this->style_plugin['module'] || $type != $this->style_plugin['type']) {
      return TRUE;
    }
  }
  if ($form_state['values']['base'] != 'all' && $form_state['values']['base'] != $this->style_plugin['name']) {
    return TRUE;
  }
  return parent::list_filter($form_state, $item);
}