'. check_plain($output) .''; } } /** * Implementation of hook_context_plugins(). * This is a ctools plugins hook. */ function context_layouts_context_plugins() { return array( 'context_layouts_reaction_block' => array( 'handler' => array( 'path' => drupal_get_path('module', 'context_layouts') .'/plugins', 'file' => 'context_layouts_reaction_block.inc', 'class' => 'context_layouts_reaction_block', 'parent' => 'context_reaction_block', ), ), ); } /** * Implementation of hook_context_registry_alter(). */ function context_layouts_context_registry_alter(&$registry) { if (isset($registry['reactions']['block'])) { $registry['reactions']['block']['plugin'] = 'context_layouts_reaction_block'; } } /** * Implementation of hook_context_page_reaction(). */ function context_layouts_context_page_reaction() { $plugin = context_get_plugin('reaction', 'block'); if ($plugin && method_exists($plugin, 'add_layout_stylesheet')) { $plugin->add_layout_stylesheet(); } } /** * Preprocessor for theme('page'). */ function context_layouts_preprocess_page(&$vars) { $plugin = context_get_plugin('reaction', 'block'); if ($plugin && method_exists($plugin, 'add_layout_stylesheet')) { $plugin->add_layout_template($vars); } } /** * Retrieve layouts for the specified theme. */ function context_layouts_get_layouts($theme = NULL, $reset = FALSE) { static $layouts = array(); $layouts = $reset ? array() : $layouts; global $theme_key; $theme = isset($theme) ? $theme : $theme_key; if (!isset($layouts[$theme])) { $info = context_get_info('theme', $theme); $themes = array(); // Find all our ancestor themes that use layouts. if (isset($info['base theme'])) { while (!empty($info['base theme'])) { $base_theme = $info['base theme']; $info = context_get_info('theme', $base_theme); $themes[$base_theme] = $info; } } // Assemble in inheritance order and add the theme on. $themes = array_reverse($themes); $themes[$theme] = context_get_info('theme', $theme); // Merge layout info into a single array. foreach ($themes as $key => $info) { if (!empty($info['layouts'])) { foreach ($info['layouts'] as $layout => $layout_info) { $layout_info['theme'] = $key; $layouts[$theme][$layout] = $layout_info; } } } } return isset($layouts[$theme]) ? $layouts[$theme] : FALSE; } /** * Get the active layout for the current page. */ function context_layouts_get_active_layout($info = TRUE) { $plugin = context_get_plugin('reaction', 'block'); if ($plugin && method_exists($plugin, 'add_layout_stylesheet')) { return $plugin->get_active_layout($info); } }