Problem/Motivation

Follow-up to #2122087: Remove references to hook_init()

Hmmm... the twig_init() function seems a bit pointless no?

Couldn't...

      if (function_exists($theme_engine . '_init')) {
        foreach ($active_theme->getBaseThemes() as $base) {
          call_user_func($theme_engine . '_init', $base->getExtension());
        }
        call_user_func($theme_engine . '_init', $active_theme->getExtension());
      }

be the following code instead...

  foreach ($active_theme->getBaseThemes() as $base) {
    $base->getExtension()->load();
  }
  $active_theme->getExtension()->load();

I think we should consider refactoring this as theme engine loading was some of the last work we did before RC.

Is there a case where the $theme_engine . '_init' function will be more complex?

Proposed resolution

Deprecate THEME_ENGINE_init() hook. Let people override or extend the Extension::load()

Remaining tasks

  1. Code to remove.
  2. Change record.

User interface changes

API changes

Deprecate THEME_ENGINE_init()

Comments

joelpittet created an issue. See original summary.

Cottser’s picture

Issue tags: -rc eligible
dawehner’s picture

In order to be able to do that, we would need a dedicated extension object for theme engines.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

Issue summary: View changes
Status: Postponed » Active

Re-opening and removed the 'remove' option from the tasks, this would need to deprecate it

joelpittet’s picture

Status: Active » Needs review
FileSize
3.12 KB

Not sure if this will work or not but seems to be correct. All the getOwner stuff does the same as the Extension::load() includes.

Status: Needs review » Needs work

The last submitted patch, 7: 2620148-7.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
3.54 KB

re-try

amit.drupal’s picture

Do some changes in patch #9
@joelpittet please review.

joelpittet’s picture

@amit.drupal, it's a bit tricky to see what you changed in this case. Could you explain what you were changing?

amit.drupal’s picture

@joelpittet Thanks for review my patch.
I found foreach loop used twice so I have merge both foreach loop .

amit.drupal’s picture

@joelpittet please review and update issues.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.