示例#1
0
 /**
  * Returns a system batch page.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The current request object.
  *
  * @return mixed
  *   A \Symfony\Component\HttpFoundation\Response object or page element or
  *   NULL.
  *
  * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
  */
 public function batchPage(Request $request)
 {
     require_once DRUPAL_ROOT . '/core/includes/batch.inc';
     $output = _batch_page($request);
     if ($output === FALSE) {
         throw new AccessDeniedHttpException();
     } elseif ($output instanceof Response) {
         return $output;
     } elseif (isset($output)) {
         // Force a page without blocks or messages to
         // display a list of collected messages later.
         drupal_set_page_content($output);
         $page = element_info('page');
         $page['#show_messages'] = FALSE;
         $page = $this->render($page);
         return $page;
     }
 }
 function page_content($js, $input, $entity, $view_mode)
 {
     $panelizer = $entity->panelizer[$view_mode];
     if (empty($panelizer)) {
         return MENU_NOT_FOUND;
     }
     list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
     $form_state = array('entity' => $entity, 'revision info' => $this->entity_allows_revisions($entity), 'display cache' => panels_edit_cache_get(implode(':', array_filter(array('panelizer', $this->entity_type, $entity_id, $view_mode, $revision_id)))), 'no_redirect' => TRUE);
     ctools_include('common', 'panelizer');
     $output = drupal_build_form('panelizer_edit_content_form', $form_state);
     if (!empty($form_state['executed'])) {
         if (!empty($form_state['clicked_button']['#save-display'])) {
             drupal_set_message(t('The settings have been updated.'));
             $entity->panelizer[$view_mode]->display = $form_state['display'];
             $entity->panelizer[$view_mode]->display_is_modified = TRUE;
             $this->entity_save($entity);
         } else {
             drupal_set_message(t('Changes have been discarded.'));
         }
         panels_edit_cache_clear($form_state['display cache']);
         drupal_goto($_GET['q']);
     }
     $output = $this->wrap_entity_panelizer_pages($entity, $view_mode, $output);
     ctools_set_no_blocks(FALSE);
     drupal_set_page_content($output);
     $page = element_info('page');
     return $page;
 }
示例#3
0
/**
 * Implements hook_page_alter().
 */
function alpha_page_alter(&$vars)
{
    $theme = alpha_get_theme();
    $theme->settings['debug']['access'] = alpha_debug_access($GLOBALS['user'], $theme->settings['debug']['roles']);
    // If no module has taken care of the main content, add it to the page now.
    // This allows the site to still be usable even if no modules that
    // control page regions (for example, the Block module) are enabled.
    if (!drupal_static('system_main_content_added', FALSE)) {
        $vars['content']['system_main'] = drupal_set_page_content();
    }
    if (($theme->settings['debug']['access'] || $GLOBALS['user']->uid == 1) && ($theme->settings['debug']['grid'] || $theme->settings['debug']['block'])) {
        drupal_add_css(drupal_get_path('theme', 'alpha') . '/css/alpha-debug.css', array('group' => CSS_THEME, 'weight' => -5));
        drupal_add_js(drupal_get_path('theme', 'alpha') . '/js/alpha-debug.js', array('group' => JS_THEME, 'weight' => -5));
        if ($theme->settings['responsive']) {
            $vars['page_bottom']['alpha_resize_indicator'] = array('#type' => 'markup', '#markup' => '<div class="alpha-resize-indicator"></div>');
        }
        if ($theme->settings['debug']['grid']) {
            $vars['page_bottom']['alpha_grid_toggle'] = array('#type' => 'markup', '#markup' => '<a class="alpha-grid-toggle" href="#"></a>');
        }
        if ($theme->settings['debug']['block']) {
            $vars['page_bottom']['alpha_block_toggle'] = array('#type' => 'markup', '#markup' => '<a class="alpha-block-toggle" href="#"></a>');
            foreach ($theme->regions as $region => $item) {
                if ($item['enabled']) {
                    if (empty($vars[$region])) {
                        $vars[$region]['#region'] = $region;
                        $vars[$region]['#theme_wrappers'] = array('region');
                    }
                    if (isset($vars[$region]['#theme_wrappers']) && array_search('region', $vars[$region]['#theme_wrappers']) !== FALSE) {
                        $vars[$region] = array('alpha_debug_' . $region => array('#type' => 'markup', '#markup' => '<div class="alpha-debug-block"><h2>' . $item['name'] . '</h2><p>' . t('This is a debugging block') . '</p></div>', '#weight' => -999)) + $vars[$region];
                    }
                }
            }
        }
    }
    if (!module_implements('alpha_page_structure_alter')) {
        alpha_alter('alpha_page_structure', $vars, $theme->theme);
    } else {
        drupal_alter('alpha_page_structure', $vars, $theme->theme);
    }
}
示例#4
0
/**
 * Implements hook_block_list_alter().
 */
function omega_block_list_alter(&$blocks)
{
    if (omega_extension_enabled('layouts') && ($layout = omega_layout())) {
        $callers = debug_backtrace();
        // Check if drupal_alter() was invoked from _block_load_blocks(). This is
        // required as we do not want to interfere with contrib modules like ctools.
        if ($callers['2']['function'] === '_block_load_blocks') {
            // In case we are currently serving a Omega layout we have to make sure
            // that we don't process blocks that will never be shown because the
            // active layout does not even have a region for them.
            foreach ($blocks as $id => $block) {
                if (!array_key_exists($block->region, $layout['info']['regions'])) {
                    unset($blocks[$id]);
                }
            }
        }
    }
    // Hide the main content block on the front page if the theme settings are
    // configured that way and there is no content set to override the homepage.
    $front = variable_get('site_frontpage', 'node');
    if ($front == 'node' && !omega_theme_get_setting('omega_toggle_front_page_content', TRUE) && drupal_is_front_page()) {
        foreach ($blocks as $key => $block) {
            if ($block->module == 'system' && $block->delta == 'main') {
                unset($blocks[$key]);
            }
        }
        drupal_set_page_content();
    }
}
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function build()
 {
     return array(drupal_set_page_content());
 }
/**
 * Implements hook_block_list_alter().
 */
function omega_block_list_alter(&$blocks)
{
    if (omega_extension_enabled('layouts') && ($layout = omega_layout())) {
        // In case we are currently serving a Omega layout we have to make sure that
        // we don't process blocks that will never be shown because the active layout
        // does not even have a region for them.
        foreach ($blocks as $id => $block) {
            if (!array_key_exists($block->region, $layout['info']['regions'])) {
                unset($blocks[$id]);
            }
        }
    }
    // Hide the main content block on the front page if the theme settings are
    // configured that way.
    if (!omega_theme_get_setting('omega_toggle_front_page_content', TRUE) && drupal_is_front_page()) {
        foreach ($blocks as $key => $block) {
            if ($block->module == 'system' && $block->delta == 'main') {
                unset($blocks[$key]);
            }
        }
        drupal_set_page_content();
    }
}