You are here

function context_layouts_reaction_block::editor_form in Context 7.3

Same name and namespace in other branches
  1. 6.3 context_layouts/plugins/context_layouts_reaction_block.inc \context_layouts_reaction_block::editor_form()
  2. 6 context_layouts/plugins/context_layouts_reaction_block.inc \context_layouts_reaction_block::editor_form()

Override of editor form.

Overrides context_reaction_block::editor_form

File

context_layouts/plugins/context_layouts_reaction_block.inc, line 63

Class

context_layouts_reaction_block

Code

function editor_form($context) {
  drupal_add_css(drupal_get_path('module', 'context_layouts') . '/plugins/context_layouts_reaction_block.css');
  $form = parent::editor_form($context);
  if ($layouts = $this
    ->get_layout_options()) {
    $options = $this
      ->fetch_from_context($context);
    $form['layout'] = array(
      // #tree *must* be true for our values to be nested correctly.
      '#tree' => TRUE,
      '#prefix' => '<div class="context-editor-block-layouts">',
      '#suffix' => '</div>',
      '#weight' => -100,
      'layout' => array(
        '#title' => t('Layout'),
        '#options' => $layouts,
        '#type' => 'select',
        '#weight' => -100,
        '#default_value' => isset($options['layout']) ? $options['layout'] : NULL,
        '#required' => FALSE,
        '#empty_value' => 0,
        '#empty_option' => '- ' . t('Site default') . ' -',
      ),
      'update' => array(
        '#value' => t('Change layout'),
        '#type' => 'submit',
      ),
    );
  }
  return $form;
}