public function isotope_reaction::execute in Isotope (with Masonry and Packery) 7
Same name and namespace in other branches
- 7.2 plugins/context/isotope_reaction.inc \isotope_reaction::execute()
Display a message to the user.
File
- plugins/
isotope_reaction.inc, line 123 - Contains the isotope_reaction subclass.
Class
- isotope_reaction
- Expose isotope configurations as context reactions.
Code
public function execute() {
foreach ($this
->get_contexts() as $k => $v) {
if (!empty($v->reactions[$this->plugin])) {
// Build the settings array for the configured Isotope reaction.
$reaction = $v->reactions[$this->plugin];
if (isset($reaction['layout_mode']) && isset($reaction['container_selector'])) {
// Top level Isotope settings.
$settings = array(
'isotope_config' => array(
'animationEngine' => !empty($reaction['animation_engine']) ? $reaction['animation_engine'] : 'best-available',
'layoutMode' => !empty($reaction['layout_mode']) ? $reaction['layout_mode'] : 'masonry',
'itemSelector' => !empty($reaction['item_selector']) ? $reaction['item_selector'] : NULL,
'resizable' => !empty($reaction['resizable']) ? $reaction['resizable'] : TRUE,
'resizesContainer' => !empty($reaction['resizes_container']) ? $reaction['resizes_container'] : TRUE,
),
'container_selector' => !empty($reaction['container_selector']) ? $reaction['container_selector'] : FALSE,
'apply_css' => !empty($reaction['apply_css']) && $reaction['apply_css'] ? $this
->get_css_settings($reaction) : FALSE,
);
// Layout specific Isotope settings.
$settings['isotope_config'][$reaction['layout_mode']] = array(
'rowHeight' => !empty($reaction['row_height']) ? $reaction['row_height'] : 240,
'columnWidth' => !empty($reaction['column_width']) ? $reaction['column_width'] : NULL,
);
// Include the Javascript required to bind the behavior.
$path = drupal_get_path('module', 'isotope');
drupal_add_js($path . '/js/isotope_reaction.js', array(
'weight' => 1,
));
// Include the Javascript to configure the Isotope Reaction.
drupal_add_js(array(
'isotope_reaction' => array(
$k => array(
'configuration' => $settings,
),
),
), 'setting');
}
}
}
}