You are here

function views_attach_plugin_display_node_content::options_form in Views attach 6

Same name and namespace in other branches
  1. 6.2 views_attach_plugin_display_node_content.inc \views_attach_plugin_display_node_content::options_form()
  2. 7.2 views_attach_plugin_display_node_content.inc \views_attach_plugin_display_node_content::options_form()

Provide the default form for setting options.

File

./views_attach_plugin_display_node_content.inc, line 76

Class

views_attach_plugin_display_node_content
The plugin that handles node-attached views.

Code

function options_form(&$form, &$form_state) {

  // It is very important to call the parent function here:
  parent::options_form($form, $form_state);
  switch ($form_state['section']) {
    case 'types':
      $form['#title'] .= t('Node types');
      $form['types'] = array(
        '#type' => 'checkboxes',
        '#multiple' => TRUE,
        '#required' => TRUE,
        '#title' => t("Embed this display in the following node types"),
        '#options' => node_get_types('names'),
        '#default_value' => $this
          ->get_option('types'),
      );
      break;
    case 'modes':
      $form['#title'] .= t('Build modes');
      $form['modes'] = array(
        '#type' => 'checkboxes',
        '#title' => t("Embed this display in the following build modes"),
        '#options' => views_attach_build_modes(),
        '#default_value' => $this
          ->get_option('modes'),
      );
      break;
    case 'default_argument':
      $form['#title'] .= t('Default argument');
      $form['default_argument'] = array(
        '#type' => 'checkbox',
        '#title' => t('Provide the current node id as a default argument.'),
        '#default_value' => $this
          ->get_option('default_argument') === 'nid',
        '#return_value' => 'nid',
      );
      break;
    case 'show_title':
      $form['#title'] .= t('Show title');
      $form['show_title'] = array(
        '#type' => 'checkbox',
        '#title' => t('Show the title of the view above the attached view.'),
        '#default_value' => $this
          ->get_option('show_title'),
      );
      break;
  }
}