Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xano’s picture

Assigned: Xano » Unassigned
Status: Active » Needs review
FileSize
1.77 KB

The patch updates a code comment and removes two code usages in phptemplate.engine and twig.engine as I couldn't find any invocation of those hooks, and HEAD is not currently broken.

Status: Needs review » Needs work

The last submitted patch, drupal_2122087_1.patch, failed testing.

swentel’s picture

Well, the init hooks in the theme engines aren't gone. One could argue they are poorly named, but they are called from _drupal_theme_initialize()

InternetDevels’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
1.08 KB
1.78 KB

Updated patch.

Xano’s picture

tstoeckler’s picture

Can we add a @see to _drupal_theme_initialize() ? That would be incredibly helpful.

Berdir’s picture

See also the changes happening in #340723: Make modules and installation profiles only require .info.yml files, the passed argument is no longer a stdClass. But it's probably better to wait with this until that issue has been committed to avoid unnecessary conflicts/re-rolls.

sun’s picture

Component: base system » theme system
Status: Needs review » Needs work

hook_init() is part of the Theme Engine API — a crucial part even.

It would probably be best to establish documentation for this callback (not hook) in /core/modules/system/theme.api.php

At least, that is the API documentation file that documents all theme related callbacks and hooks. (I don't think we ever had proper API docs for theme engines.)

Closely related: #1685492: Convert theme engines into services

tim.plunkett’s picture

star-szr’s picture

Issue tags: +rc eligible, +Novice, +Twig, +Needs reroll

This is docs only so it's still viable for RC. Needs a reroll - phptemplate is gone but nyan_cat_init() is in :)

alvar0hurtad0’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.08 KB

that's the reroll.

subhojit777’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Needs review » Reviewed & tested by the community

Patch seems ok to me. Thanks!

catch’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/system/tests/themes/engines/nyan_cat/nyan_cat.engine
@@ -8,7 +8,10 @@
+ * @param stdClass $template

Shouldn't the type hint be on the Extension class?

star-szr’s picture

Status: Needs review » Needs work

Yeah and "Theme template object" doesn't seem right either anymore.

rakesh.gectcr’s picture

I have done the following changes

 /**
- * Implements hook_init().
+ * Includes .theme file, which contains functions to support theming.
+ *
+ * @param \Drupal\Core\Extension\Extension $theme
+ *   Theme template object.
  */
rakesh.gectcr’s picture

Status: Needs work » Needs review
catch’s picture

Version: 8.1.x-dev » 8.0.x-dev
star-szr’s picture

Status: Needs review » Needs work

Theme template object still seems wrong, it's an extension object. So maybe something like "The theme extension object."?

Thanks.

rakesh.gectcr’s picture

@Cottser

I updated to

- * Implements hook_init().
+ * Includes .theme file, which contains functions to support theming.
+ *
+ * @param \Drupal\Core\Extension\Extension $theme
+ *   The theme extension object.
rakesh.gectcr’s picture

Status: Needs work » Needs review
lauriii’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/tests/themes/engines/nyan_cat/nyan_cat.engine
@@ -8,7 +8,10 @@
+ * Includes .theme file, which contains functions to support theming.

The wording could be just simply "Includes .theme file from themes." because I feel like the information where its being loaded is more important than information what .theme file is.

snehi’s picture

Status: Needs work » Needs review
FileSize
1.06 KB
1.01 KB

Done as stated by #21

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Looks good for me! Thanks @snehi!

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

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?

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

@alexpott I think you are totally right. This is still RTBC as such but I've opened up a follow-up so that we can refactor the ENGINE_init to load.

Doubtful we can do that change in 8.0.1 as it's not a bug, but this one we can.

  • catch committed e18279a on 8.1.x
    Issue #2122087 by rakesh.gectcr, snehi, InternetDevels, Xano,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed 7b7bc34 on 8.0.x
    Issue #2122087 by rakesh.gectcr, snehi, InternetDevels, Xano,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.