You are here

function views_menu_children_sort_handler::options_form in Views Menu Node Children Filter 7

Basic options for all sort criteria

Overrides views_handler_sort::options_form

File

includes/views_menu_children_sort_handler.inc, line 54

Class

views_menu_children_sort_handler

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // TODO: Change the autogenerated stub
  $conflicting_selected_menu = $this
    ->hasAttachedContextFilter();
  $default_value = !$conflicting_selected_menu ? $this->options['target_menu'] : $conflicting_selected_menu;
  \views_menu_children_argument::buildMenuSelectForm($form, $form_state, $default_value . '');

  // If there is a conflicting menu selected in the argument handler, disable
  // the select box here and tell the user they can't change the selection.
  if (!empty($conflicting_selected_menu)) {
    $form['target_menu']['#attributes']['disabled'] = 'disabled';
    $form['target_menu']['#description'] = t("This option is locked because you have a \"Menu children\" contextual filter already configured for this view.\n<br />When a Menu Children context filter and Menu Children sort are applied to the same view, they must use the same target menu.\n<br/>To change the target menu, make the change to the contextual filter.");
  }
}