class context_omega_reaction_omega_layout in Context omega 7
Hierarchy
- class \context_reaction
Expanded class hierarchy of context_omega_reaction_omega_layout
2 string references to 'context_omega_reaction_omega_layout'
- context_omega_context_plugins in ./
context_omega.module - Implements hook_context_plugins().
- context_omega_context_registry_alter in ./
context_omega.module - Implements hook_context_registry_alter().
File
- plugins/
context_omega_reaction_omega_layout.inc, line 3
View source
class context_omega_reaction_omega_layout extends context_reaction_block {
/**
* Options form.
*/
function options_form($context) {
$form = parent::options_form($context);
if ($layouts = context_omega_get_layouts()) {
$options = $regions = array();
foreach ($layouts as $key => $layout) {
$regions[$key] = array_keys($layout['info']['regions']);
$options[$key] = $layout['info']['name'];
}
asort($layouts);
$values = $this
->fetch_from_context($context);
$form['layout'] = array(
'#title' => t('Choose an Omega layout'),
'#description' => t('Choose the Omega layout to use.'),
'#type' => 'select',
'#options' => $options,
'#default_value' => isset($values['layout']) ? $values['layout'] : NULL,
'#weight' => -10,
'#empty_value' => '_default',
'#empty_option' => t('Default'),
'#attributes' => array(
'class' => array(
'context-omega-layout-select',
),
),
);
drupal_add_js(drupal_get_path('module', 'context_omega') . '/plugins/context_omega_reaction_omega_layout.js');
drupal_add_js(array(
'contextOmega' => array(
'regions' => $regions,
),
), 'setting');
}
return $form;
}
/**
* Override of submit handler.
*/
function options_form_submit($values) {
$options = parent::options_form_submit($values);
// Check whether a valid layout was selected.
$layouts = context_omega_get_layouts();
if (!empty($values['layout']) && isset($layouts[$values['layout']])) {
$options['layout'] = $values['layout'];
// Unset blocks attached to invalid regions.
foreach ($options['blocks'] as $key => $block) {
if (!isset($layouts[$options['layout']]['info']['regions'][$block['region']])) {
unset($options['blocks'][$key]);
}
}
}
return $options;
}
/**
* Retrieves the first layout specified by one of the active contexts.
*/
function get_active_layout() {
foreach ($this
->get_contexts() as $context) {
$values = $this
->fetch_from_context($context);
if (isset($values['layout'])) {
return $values['layout'];
}
}
// None of the active contexts specified a layout.
return FALSE;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_omega_reaction_omega_layout:: |
function | Retrieves the first layout specified by one of the active contexts. | ||
context_omega_reaction_omega_layout:: |
function |
Options form. Overrides context_reaction_block:: |
||
context_omega_reaction_omega_layout:: |
function |
Override of submit handler. Overrides context_reaction_block:: |
||
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
function | Retrieve options from the context provided. | 1 | |
context_reaction:: |
function | Retrieve active contexts that have values for this reaction. | ||
context_reaction:: |
function | Clone our references when we're being cloned. | ||
context_reaction:: |
function | Constructor. Do not override. | ||
context_reaction_block:: |
function | Get a renderable array of a region containing all enabled blocks. | ||
context_reaction_block:: |
function | An alternative version of block_list() that provides any context enabled blocks. | ||
context_reaction_block:: |
static | function | Sort callback. | |
context_reaction_block:: |
private | function | Allow modules to selectively allow ajax rendering of a specific block | |
context_reaction_block:: |
protected | function | Add markup for making a block editable. | |
context_reaction_block:: |
protected | function | Add markup for making a region editable. | |
context_reaction_block:: |
function | Context editor form for blocks. | 1 | |
context_reaction_block:: |
function | Submit handler context editor form. | 1 | |
context_reaction_block:: |
function | Execute. | ||
context_reaction_block:: |
function | Helper function to generate a list of blocks from a specified region. If provided a context object, will generate a full list of blocks for that region distinguishing between system blocks and context-provided blocks. | ||
context_reaction_block:: |
function | Determine if there is an active context editor block, and set a flag. We will set a flag so that we can make sure that blocks with empty content have some default content. This is needed so the save of the context inline editor does not remove the… | ||
context_reaction_block:: |
protected | function | Determine whether inline editing requirements are met and that the current user may edit. | |
context_reaction_block:: |
protected | function | Return a list of enabled regions for which blocks should be built. Split out into a separate method for easy overrides in extending classes. | 1 |
context_reaction_block:: |
protected | function | Compatibility wrapper around json_decode(). | |
context_reaction_block:: |
protected | function | Generate the safe weight range for a block being added to a region such that there are enough potential unique weights to support all blocks. | |
context_reaction_block:: |
function | Check or set whether a rebuild of the block info cache is needed. | ||
context_reaction_block:: |
function | Block renderer for AJAX requests. Triggered when $_GET['context_block'] is set. See ->execute() for how this is called. | ||
context_reaction_block:: |
function |
Settings form for variables. Overrides context_reaction:: |
||
context_reaction_block:: |
protected | function | Provide caching for system_region_list since it can get called frequently. Evaluate for removal once https://drupal.org/node/1873450 lands or system_region_list is otherwise cached in core |