function views_plugin_display::add_override_button

Add an override button for a given section, allowing the user to change whether this info is stored on the default display or on the current display.

1 call to views_plugin_display::add_override_button()
views_plugin_display::options_form in plugins/views_plugin_display.inc
Provide the default form for setting options.

File

plugins/views_plugin_display.inc, line 2247

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

function add_override_button(&$form, &$form_state, $section) {
    if ($this->is_default_display()) {
        return;
    }
    $form['override'] = array(
        '#prefix' => '<div class="views-override clear-block">',
        '#suffix' => '</div>',
    );
    if ($this->is_defaulted($section)) {
        $form['override']['button'] = array(
            '#type' => 'submit',
            '#value' => t('Override'),
            '#submit' => array(
                'views_ui_edit_display_form_override',
            ),
        );
        $form['override']['markup'] = array(
            '#prefix' => '<div class="description">',
            '#value' => theme('advanced_help_topic', 'views', 'overrides') . t('Status: using default values.'),
            '#suffix' => '</div>',
        );
        $form_state['update_name'] = t('Update default display');
    }
    else {
        $form['override']['button'] = array(
            '#type' => 'submit',
            '#value' => t('Use default'),
            '#submit' => array(
                'views_ui_edit_display_form_override',
            ),
        );
        $form['override']['markup'] = array(
            '#prefix' => '<div class="description">',
            '#value' => theme('advanced_help_topic', 'views', 'overrides') . t('Status: using overridden values.'),
            '#suffix' => '</div>',
        );
        $form_state['update_name'] = NULL;
    }
}