You are here

class views_custom_conditions_plugin_display_extender_code in Views Custom Conditions 7

The plugin that added additional setting to views edit form.

Hierarchy

Expanded class hierarchy of views_custom_conditions_plugin_display_extender_code

1 string reference to 'views_custom_conditions_plugin_display_extender_code'
views_custom_conditions_views_plugins in ./views_custom_conditions.views.inc
Implements hook_views_plugins().

File

./views_custom_conditions_plugin_display_extender_code.inc, line 12
Contains the class to extend views display plugins browse all link.

View source
class views_custom_conditions_plugin_display_extender_code extends views_plugin_display_extender {

  // Provide a form to edit options for this plugin.
  function options_definition() {
    $options['views_custom_conditions'] = array(
      'default' => '',
    );
  }

  /**
   * Provide the form to set new option.
   */
  function options_form(&$form, &$form_state) {
    switch ($form_state['section']) {
      case 'views_custom_conditions':
        $form['#title'] .= t('Setting');
        $form['views_custom_conditions'] = array(
          '#type' => 'textarea',
          '#description' => t('Please enter table,field,desired match value and operator name saprated by "|" symbol. eg:- A). node|title|%2%|LIKE,B). users|uid|arg1,arg2,arg3|IN. Please use next line for multiple index.'),
          '#default_value' => $this->display
            ->get_option('views_custom_conditions'),
        );
        break;
    }
  }

  /**
   * Inserts the code into the view display.
   */
  function options_submit(&$form, &$form_state) {

    // Not sure I like this being here, but it seems (?) like a logical place.
    $new_option = $form_state['values']['views_custom_conditions'];
    variable_set('views_custom_conditions_' . $form_state['view']->current_display . '_' . $form_state['view']->name, $new_option);
    switch ($form_state['section']) {
      case 'views_custom_conditions':
        variable_set('views_custom_conditions_' . $form_state['values']['override']['dropdown'], $new_option);
        wr($form_state['values']['override']);
        if ($form_state['values']['override']['dropdown'] == 'default') {
          variable_set('views_custom_conditions_' . $form_state['view']->current_display . '_' . $form_state['view']->name, '');
        }
        $this->display
          ->set_option('views_custom_conditions', $new_option);
        $empty = trim($new_option);
        $empty = empty($empty);
        break;
    }
    foreach ($this->extender as $extender) {
      $extender
        ->options_submit($form, $form_state);
    }
  }

  /**
   * Summarizes new option.
   *
   * Lists the fields as either 'Yes' if there is text or 'None' otherwise and
   * categorizes the fields under the 'Other' category.
   */
  function options_summary(&$categories, &$options) {
    $new_option = check_plain(trim($this->display
      ->get_option('views_custom_conditions')));
    if ($new_option) {
      $new_option = t('Set');
    }
    else {
      $new_option = t('Not Set');
    }
    $options['views_custom_conditions'] = array(
      'category' => 'other',
      'title' => t('Views Custom Conditions'),
      'value' => $new_option,
      'desc' => t('Add some option.'),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_custom_conditions_plugin_display_extender_code::options_definition function
views_custom_conditions_plugin_display_extender_code::options_form function Provide the form to set new option. Overrides views_plugin_display_extender::options_form
views_custom_conditions_plugin_display_extender_code::options_submit function Inserts the code into the view display. Overrides views_plugin_display_extender::options_submit
views_custom_conditions_plugin_display_extender_code::options_summary function Summarizes new option. Overrides views_plugin_display_extender::options_summary
views_object::$definition public property Handler's definition.
views_object::$options public property Except for displays, options for the object will be held here. 1
views_object::altered_option_definition function Collect this handler's option definition and alter them, ready for use.
views_object::construct public function Views handlers use a special construct function. 4
views_object::destroy public function Destructor. 2
views_object::export_option public function 1
views_object::export_options public function
views_object::export_option_always public function Always exports the option, regardless of the default value.
views_object::options Deprecated public function Set default options on this object. 1
views_object::option_definition public function Information about options for all kinds of purposes will be held here. 13
views_object::set_default_options public function Set default options.
views_object::set_definition public function Let the handler know what its full definition is.
views_object::unpack_options public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable public function Unpack a single option definition.
views_object::unpack_translatables public function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults public function
views_plugin::$display public property The current used views display.
views_plugin::$plugin_name public property The plugin name of this plugin, for example table or full.
views_plugin::$plugin_type public property The plugin type of this plugin, for example style or query.
views_plugin::$view public property The top object of a view. Overrides views_object::$view 1
views_plugin::additional_theme_functions public function Provide a list of additional theme functions for the theme info page.
views_plugin::plugin_title public function Return the human readable name of the display.
views_plugin::summary_title public function Returns the summary of the settings in the display. 8
views_plugin::theme_functions public function Provide a full list of possible theme templates used by this style.
views_plugin::validate public function Validate that the plugin is correct and can be saved. 3
views_plugin_display_extender::defaultable_sections public function Static member function to list which sections are defaultable and what items each section contains.
views_plugin_display_extender::init public function
views_plugin_display_extender::options_definition_alter public function Provide a form to edit options for this plugin.
views_plugin_display_extender::options_validate public function Validate the options form. Overrides views_plugin::options_validate
views_plugin_display_extender::pre_execute public function Set up any variables on the view prior to execution.
views_plugin_display_extender::query public function Inject anything into the query that the display_extender handler needs. Overrides views_plugin::query