function ctools_custom_content_ui::edit_form

Overrides ctools_export_ui::edit_form

File

ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php, line 5

Class

ctools_custom_content_ui

Code

public function edit_form(&$form, &$form_state) {
    // Correct for an error that came in because filter format changed.
    if (is_array($form_state['item']->settings['body'])) {
        $form_state['item']->settings['format'] = $form_state['item']->settings['body']['format'];
        $form_state['item']->settings['body'] = $form_state['item']->settings['body']['value'];
    }
    parent::edit_form($form, $form_state);
    $form['category'] = array(
        '#type' => 'textfield',
        '#title' => t('Category'),
        '#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'),
        '#default_value' => $form_state['item']->category,
    );
    $form['title'] = array(
        '#type' => 'textfield',
        '#default_value' => $form_state['item']->settings['title'],
        '#title' => t('Title'),
    );
    $form['title_heading'] = array(
        '#title' => t('Title heading'),
        '#type' => 'select',
        '#default_value' => isset($form_state['item']->settings['title_heading']) ? $form_state['item']->settings['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'),
        ),
    );
    $form['body'] = array(
        '#type' => 'text_format',
        '#title' => t('Body'),
        '#default_value' => $form_state['item']->settings['body'],
        '#format' => $form_state['item']->settings['format'],
    );
    $form['substitute'] = array(
        '#type' => 'checkbox',
        '#title' => t('Use context keywords'),
        '#description' => t('If checked, context keywords will be substituted in this content.'),
        '#default_value' => !empty($form_state['item']->settings['substitute']),
    );
}