Ejemplo n.º 1
0
 function setUp()
 {
     parent::setUp();
     // There are dependencies in drupal_get_js() on the theme layer so we need
     // to initialize it.
     drupal_theme_initialize();
 }
 /**
  * Initializes the theme system after the routing system.
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  *   The Event to process.
  */
 public function onKernelRequestThemeNegotiator(GetResponseEvent $event)
 {
     if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
         if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') {
             // @todo Refactor drupal_theme_initialize() into a request subscriber.
             // @see https://drupal.org/node/2228093
             drupal_theme_initialize(RouteMatch::createFromRequest($event->getRequest()));
         }
     }
 }
Ejemplo n.º 3
0
 function setUp()
 {
     parent::setUp();
     // There are dependencies in drupal_get_js() on the theme layer so we need
     // to initialize it.
     drupal_theme_initialize();
     // Disable preprocessing
     $config = \Drupal::config('system.performance');
     $this->preprocess_js = $config->get('js.preprocess');
     $config->set('js.preprocess', 0);
     $config->save();
     // Reset _drupal_add_js() statics before each test.
     drupal_static_reset('_drupal_add_js');
 }
Ejemplo n.º 4
0
 /**
  * Declares the subcomponents for this component.
  *
  * These are not necessarily child classes, just components this needs.
  *
  * @return
  *  An array of subcomponent types.
  */
 protected function requiredComponents()
 {
     $theme_data = $this->component_data;
     //drush_print_r($theme_data);
     drupal_theme_initialize();
     $theme_registry = theme_get_registry();
     $components = array();
     foreach ($this->component_data['themeables'] as $theme_hook_name) {
         $hook = $theme_hook_name;
         // Iteratively strip everything after the last '--' delimiter, until an
         // implementation is found.
         // (We use -- rather than __ because they're easier to type!)
         // TODO: allow both!
         while ($pos = strrpos($hook, '--')) {
             $hook = substr($hook, 0, $pos);
             if (isset($theme_registry[$hook])) {
                 break;
             }
         }
         if (!isset($theme_registry[$hook])) {
             // Bad name. Skip it.
             continue;
         }
         //drush_print_r($hook);
         if (isset($theme_registry[$hook]['template'])) {
             $components[$theme_hook_name] = 'themeTemplate';
             // Store data about this theme hook that we've found.
             $this->component_data['theme_hook_bases'][$theme_hook_name] = $hook;
         } else {
             // Fall through, as 'function' is optional in hook_theme().
             // TODO: we don't do theme functions yet -- need a system to add code
             // to existing files!
             //$components[$theme_hook_name] = 'theme_function';
         }
     }
     //drush_print_r($components);
     return $components;
 }
Ejemplo n.º 5
0
 /**
  * Wraps drupal_theme_initialize().
  */
 protected function initializeTheme()
 {
     drupal_theme_initialize();
 }
Ejemplo n.º 6
0
 public function initializeTheme()
 {
     // Let all modules take action before the menu system handles the request.
     // We do not want this while running update.php.
     if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') {
         // Prior to invoking hook_init(), initialize the theme (potentially a custom
         // one for this page), so that:
         // - Modules with hook_init() implementations that call theme() or
         //   theme_get_registry() don't initialize the incorrect theme.
         // - The theme can have hook_*_alter() implementations affect page building
         //   (e.g., hook_form_alter(), hook_node_view_alter(), hook_page_alter()),
         //   ahead of when rendering starts.
         menu_set_custom_theme();
         drupal_theme_initialize();
     }
 }
Ejemplo n.º 7
0
 public function themeRegistry()
 {
     drupal_theme_initialize();
     $hooks = theme_get_registry();
     ksort($hooks);
     return kprint_r($hooks, TRUE);
 }
Ejemplo n.º 8
0
 /**
  * Completes the remaining parts of DRUPAL_BOOTSTRAP_FULL that conflict
  * with the Symfony router.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequestAfterFirewall(GetResponseEvent $event)
 {
     if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
         // Prior to invoking hook_init(), initialize the theme (potentially a custom
         // one for this page), so that:
         // - Modules with hook_init() implementations that call theme() or
         //   theme_get_registry() don't initialize the incorrect theme.
         // - The theme can have hook_*_alter() implementations affect page building
         //   (e.g., hook_form_alter(), hook_node_view_alter(), hook_page_alter()),
         //   ahead of when rendering starts.
         menu_set_custom_theme();
         drupal_theme_initialize();
         module_invoke_all('init');
     }
 }