Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300789

Replace 'theme callback' and hook_custom_theme() with a clean theme negotiation system

$
0
0

Problem/Motivation

In drupal 7 there has been different ways to change the current active theme on the page:

  • You could use the 'theme callback' on the hook_menu() definition of the current page
  • You could use hook_custom_theme() which was triggered really early in the bootstrap

Proposed resolution

The idea is to add a similar kind of mechanism like breadcrumb does, so multiple services can set the current active theme,
if wanted. By default the active theme is determined from the config, but there is also a theme determined by the user setting.

If something like OG comes in , they would just implement the service and override if needed.

Remaining tasks

(reviews needed, tests to be written or run, documentation to be written, etc.)

User interface changes

(New or changed features/functionality in the user interface, modules added or removed, changes to URL paths, changes to user interface text.)

API changes

This removes hook_custom_theme() and removes 'theme callback' from hook_menu()

@todo Fill out.

Original report

Hook menu allowed items to specify a theme callback which is called to determine the used theme.

  $items['system/ajax'] = array(
    'title' => 'AHAH callback',
    'page callback' => 'ajax_form_callback',
    'access callback' => TRUE,
    'theme callback' => 'ajax_base_page_theme',
    'type' => MENU_CALLBACK,
    'file path' => 'core/includes',
    'file' => 'form.inc',
  );

This has to happen somehow early in the request (before the actual _controller is called. It could be a method defined on the route or simply something manually called in your controller, though this feels wrong.


Viewing all articles
Browse latest Browse all 300789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>