Problem/Motivation

Now when I started testing specific preprocess functions in more complicated use cases I figured out that we forgot to add support for second level of preprocess functions (hook__foo__bar) without first level appearing at all (hook__foo).

Proposed resolution

Make it support the second level.

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lauriii created an issue. See original summary.

lauriii’s picture

Title: specific preprocess functions doesn't support second level without first level » Specific preprocess functions doesn't support second level without first level
davidhernandez’s picture

I don't quite understand. Are you saying you want to preprocess something specific when the actual theme implementation doesn't exist? Can you provide a non-generic example, like you were doing this with nodes or fields?

lauriii’s picture

I'm saying that hook_preprocess_field__node__article doesn't work without hook_preprocess_field__node being defined because of the logic inside Registry::postProcessExtension()

RainbowArray’s picture

I didn't even know that was a thing.

lauriii’s picture

Antti J. Salminen’s picture

Assigned: Unassigned » Antti J. Salminen

Working on this.

Antti J. Salminen’s picture

A test and the proposed fix.

Antti J. Salminen’s picture

Also removing workaround that exists because of this issue, should pass without it now...

The last submitted patch, 8: specific_preprocess-2556785-test-8.patch, failed testing.

markhalliwell’s picture

I didn't even know that was a thing.

Yes, second... (or more) levels of template/preprocessing suggestions is a "thing". I would imagine that most people don't know or use this in core/contrib because it's not really that necessary (yet). However, in any given client site/theme where it is rather complex, this pattern will undoubtedly be used and taken advantage of.

lauriii’s picture

Uploading a test only patch from the previous patch

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Ups there was a test only patch but I missed it from the first comment... Sorry for the noise.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: specific_preprocess-2556785-9-test-only.patch, failed testing.

Antti J. Salminen’s picture

Status: Needs work » Reviewed & tested by the community

The status was only reset because of the second test only patch finishing. Setting back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

It's good to have this fixed. This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 5a79883 and pushed to 8.0.x. Thanks!

@lauriii if you upload a test-only.patch after the rtbc patch - upload the rtbc patch again too so automated rtbc testing does not come around and set this to needs work.

  • alexpott committed 5a79883 on 8.0.x
    Issue #2556785 by Antti J. Salminen, lauriii: Specific preprocess...

Status: Fixed » Closed (fixed)

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