function views_handler_area_text::options_form

Overrides views_handler_area::options_form

1 call to views_handler_area_text::options_form()
views_handler_area_text_custom::options_form in handlers/views_handler_area_text_custom.inc
Default options form that provides the label widget that all fields should have.
1 method overrides views_handler_area_text::options_form()
views_handler_area_text_custom::options_form in handlers/views_handler_area_text_custom.inc
Default options form that provides the label widget that all fields should have.

File

handlers/views_handler_area_text.inc, line 38

Class

views_handler_area_text
Views area text handler.

Code

public function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['content'] = array(
        '#type' => 'text_format',
        '#default_value' => $this->options['content'],
        '#rows' => 6,
        '#format' => isset($this->options['format']) ? $this->options['format'] : filter_default_format(),
        '#wysiwyg' => FALSE,
    );
    // @todo Refactor token handling into a base class.
    $form['tokenize'] = array(
        '#type' => 'checkbox',
        '#title' => t('Use replacement tokens from the first row'),
        '#default_value' => $this->options['tokenize'],
    );
    // Get a list of the available fields and arguments for token replacement.
    $options = array();
    foreach ($this->view->display_handler
        ->get_handlers('field') as $field => $handler) {
        $options[t('Fields')]["[{$field}]"] = $handler->ui_name();
    }
    $count = 0;
    // This lets us prepare the key as we want it printed.
    foreach ($this->view->display_handler
        ->get_handlers('argument') as $handler) {
        $options[t('Arguments')]['%' . ++$count] = t('@argument title', array(
            '@argument' => $handler->ui_name(),
        ));
        $options[t('Arguments')]['!' . $count] = t('@argument input', array(
            '@argument' => $handler->ui_name(),
        ));
    }
    if (!empty($options)) {
        $output = '<p>' . t("The following tokens are available. If you would like to have the characters '[' and ']' please use the html entity codes '%5B' or '%5D' or they will get replaced with empty space.") . '</p>';
        foreach (array_keys($options) as $type) {
            if (!empty($options[$type])) {
                $items = array();
                foreach ($options[$type] as $key => $value) {
                    $items[] = $key . ' == ' . check_plain($value);
                }
                $output .= theme('item_list', array(
                    'items' => $items,
                    'type' => $type,
                ));
            }
        }
        $form['token_help'] = array(
            '#type' => 'fieldset',
            '#title' => t('Replacement patterns'),
            '#collapsible' => TRUE,
            '#collapsed' => TRUE,
            '#value' => $output,
            '#id' => 'edit-options-token-help',
            '#dependency' => array(
                'edit-options-tokenize' => array(
                    1,
                ),
            ),
            '#prefix' => '<div>',
            '#suffix' => '</div>',
        );
    }
}