function ViewsUiBaseViewsWizard::build_form_style

Build the part of the form that builds the display format options.

3 calls to ViewsUiBaseViewsWizard::build_form_style()
ViewsUiBaseViewsWizard::build_form in plugins/views_wizard/views_ui_base_views_wizard.class.php
For AJAX callbacks to build other elements in the "show" form.
ViewsUiCommentViewsWizard::build_form_style in plugins/views_wizard/views_ui_comment_views_wizard.class.php
Build the part of the form that builds the display format options.
ViewsUiNodeViewsWizard::build_form_style in plugins/views_wizard/views_ui_node_views_wizard.class.php
Build the part of the form that builds the display format options.
2 methods override ViewsUiBaseViewsWizard::build_form_style()
ViewsUiCommentViewsWizard::build_form_style in plugins/views_wizard/views_ui_comment_views_wizard.class.php
Build the part of the form that builds the display format options.
ViewsUiNodeViewsWizard::build_form_style in plugins/views_wizard/views_ui_node_views_wizard.class.php
Build the part of the form that builds the display format options.

File

plugins/views_wizard/views_ui_base_views_wizard.class.php, line 302

Class

ViewsUiBaseViewsWizard
A very generic Views Wizard class - can be constructed for any base table.

Code

protected function build_form_style(&$form, &$form_state, $type) {
    $style_form =& $form['displays'][$type]['options']['style'];
    $style = $style_form['style_plugin']['#default_value'];
    $style_plugin = views_get_plugin('style', $style);
    if (isset($style_plugin) && $style_plugin->uses_row_plugin()) {
        $options = $this->row_style_options($type);
        $style_form['row_plugin'] = array(
            '#type' => 'select',
            '#title' => t('of'),
            '#options' => $options,
            '#access' => count($options) > 1,
        );
        // For the block display, the default value should be "titles (linked)",
        // if it's available (since that's the most common use case).
        $block_with_linked_titles_available = $type == 'block' && isset($options['titles_linked']);
        $default_value = $block_with_linked_titles_available ? 'titles_linked' : key($options);
        $style_form['row_plugin']['#default_value'] = views_ui_get_selected($form_state, array(
            $type,
            'style',
            'row_plugin',
        ), $default_value, $style_form['row_plugin']);
        // Changing this dropdown updates the individual row options via AJAX.
        views_ui_add_ajax_trigger($style_form, 'row_plugin', array(
            'displays',
            $type,
            'options',
            'style',
            'row_options',
        ));
        // This is the region that can be updated by AJAX. The base class doesn't
        // add anything here, but child classes can.
        $style_form['row_options'] = array(
            '#theme_wrappers' => array(
                'container',
            ),
        );
    }
    elseif ($style_plugin->uses_fields()) {
        $style_form['row_plugin'] = array(
            '#markup' => '<span>' . t('of fields') . '</span>',
        );
    }
}