function stylizer_ui::list_filter

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);
}