function ctools_content_configure_form_defaults

Add the default FAPI elements to the content type configuration form.

1 string reference to 'ctools_content_configure_form_defaults'
_ctools_content_create_form_info in includes/content.inc

File

includes/content.inc, line 499

Code

function ctools_content_configure_form_defaults($form, &$form_state) {
    $plugin = $form_state['plugin'];
    $subtype = $form_state['subtype'];
    $contexts = isset($form_state['contexts']) ? $form_state['contexts'] : NULL;
    $conf = $form_state['conf'];
    $add_submit = FALSE;
    if (!empty($subtype['required context']) && is_array($contexts)) {
        $form['context'] = ctools_context_selector($contexts, $subtype['required context'], isset($conf['context']) ? $conf['context'] : array());
        $add_submit = TRUE;
    }
    ctools_include('dependent');
    // Unless we're not allowed to override the title on this content type, add this
    // gadget to all panes.
    if (empty($plugin['no title override']) && empty($subtype['no title override'])) {
        $form['aligner_start'] = array(
            '#markup' => '<div class="option-text-aligner clearfix">',
        );
        $form['override_title'] = array(
            '#type' => 'checkbox',
            '#default_value' => isset($conf['override_title']) ? $conf['override_title'] : '',
            '#title' => t('Override title'),
            '#id' => 'override-title-checkbox',
        );
        $form['override_title_text'] = array(
            '#type' => 'textfield',
            '#default_value' => isset($conf['override_title_text']) ? $conf['override_title_text'] : '',
            '#size' => 35,
            '#id' => 'override-title-textfield',
            '#dependency' => array(
                'override-title-checkbox' => array(
                    1,
                ),
            ),
            '#dependency_type' => 'hidden',
        );
        $form['override_title_heading'] = array(
            '#type' => 'select',
            '#default_value' => isset($conf['override_title_heading']) ? $conf['override_title_heading'] : 'h2',
            '#options' => array(
                'h1' => t('h1'),
                'h2' => t('h2'),
                'h3' => t('h3'),
                'h4' => t('h4'),
                'h5' => t('h5'),
                'h6' => t('h6'),
                'div' => t('div'),
                'span' => t('span'),
            ),
            '#id' => 'override-title-heading',
            '#dependency' => array(
                'override-title-checkbox' => array(
                    1,
                ),
            ),
            '#dependency_type' => 'hidden',
        );
        $form['aligner_stop'] = array(
            '#markup' => '</div>',
        );
        if (is_array($contexts)) {
            $form['override_title_markup'] = array(
                '#prefix' => '<div class="description">',
                '#suffix' => '</div>',
                '#markup' => t('You may use %keywords from contexts, as well as %title to contain the original title.'),
            );
        }
        $add_submit = TRUE;
    }
    if ($add_submit) {
        // '#submit' is already set up due to the wizard.
        $form['#submit'][] = 'ctools_content_configure_form_defaults_submit';
    }
    return $form;
}