You are here

function context_reaction_block::editor_form in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_reaction_block.inc \context_reaction_block::editor_form()
  2. 7.3 plugins/context_reaction_block.inc \context_reaction_block::editor_form()

Context editor form for blocks.

1 call to context_reaction_block::editor_form()
context_layouts_reaction_block::editor_form in context_layouts/plugins/context_layouts_reaction_block.inc
Override of editor form.
1 method overrides context_reaction_block::editor_form()
context_layouts_reaction_block::editor_form in context_layouts/plugins/context_layouts_reaction_block.inc
Override of editor form.

File

plugins/context_reaction_block.inc, line 114

Class

context_reaction_block
Expose blocks as context reactions.

Code

function editor_form($context) {
  $form = array();
  if (module_exists('jquery_ui')) {
    jquery_ui_add(array(
      'ui.draggable',
      'ui.droppable',
      'ui.sortable',
    ));
    drupal_add_js(drupal_get_path('module', 'context_ui') . '/json2.js');
    drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js');
    drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css');

    // We might be called multiple times so use a static to ensure this is set just once.
    static $once;
    if (!isset($once)) {
      $settings = array(
        'path' => url($_GET['q']),
        'params' => (object) array_diff_key($_GET, array(
          'q' => '',
        )),
        'scriptPlaceholder' => theme('context_block_script_placeholder', ''),
      );
      drupal_add_js(array(
        'contextBlockEditor' => $settings,
      ), 'setting');
      $once = TRUE;
    }
    $form['state'] = array(
      '#type' => 'hidden',
      '#attributes' => array(
        'class' => 'context-block-editor-state',
      ),
    );
    $form['browser'] = array(
      '#type' => 'markup',
      '#value' => theme('context_block_browser', $this
        ->get_blocks(NULL, NULL, $this
        ->rebuild_needed()), $context),
    );
    $this
      ->rebuild_needed(FALSE);
  }
  return $form;
}