Problem/Motivation

Part of #3504381: [meta] Convert Template Preprocess hooks to OOP equivalent

Steps to reproduce

Proposed resolution

Convert all template_preprocess functions in form.inc to a new Preprocess service, keep them as BC.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3534334

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

berdir created an issue. See original summary.

berdir’s picture

Status: Active » Needs review

I was tempted to also move form_select_options() as it's a function that in core is only used from template_preprocess_select(), but there are direct calls in contrib, so we might want to move it to FormHelper or so and that is then definitely out of scope.

Similar with form_get_options(), which is actually not called at all in core or contrib and I think we should deprecate that without replacement.

Beside those two, the only thing left in form.inc is then batch functions.

nicxvan’s picture

I have done a partial review:

I've confirmed all deprecations are 11.3 -> 12

All are __function__

All functions call the right method
All initial preprocess call the right method
All comments point to the new method

Need to run the git command to confirm the body of the methods align.

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

Ok I had a chance to finish my review with: git diff 11.x --color-moved=dimmed_zebra --color-moved-ws=ignore-all-space
See #3518822-14: Convert template preprocess hooks in core/includes/theme.inc for an explanation.

With that and my review above this is RTBC.

The only line length changes for Codesniff are the comment in the media module.

  • catch committed 026a843d on 11.x
    Issue #3534334 by berdir, nicxvan: Convert template_preprocess in form....

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

mstrelan’s picture

Sorry if I've missed something but why are we deprecating functions that never existed before? Any how come the originals have been renamed? I've definitely seen a template_preprocess function called directly before, even if that seems like a bad idea.

  • catch committed 2a3b0288 on 11.x
    Revert "Issue #3534334 by berdir, nicxvan: Convert template_preprocess...
catch’s picture

Status: Fixed » Needs work

No it's me that missed something - completely missed the double underscore being added here. Reverted for now, and yeah same question as #9 - I can understand deprecating the functions given people do call them from contrib, but for that to work they can't be renamed.

nicxvan’s picture

Yeah I missed that too, I'll add that to my checklist for these conversions.

nicxvan changed the visibility of the branch 3534334-convert-templatepreprocess-in to active.

nicxvan’s picture

Ok I reopened the mr and provided suggestions for all of the functions.

libbna’s picture

Assigned: Unassigned » libbna

I will work on the suggestions.

libbna’s picture

Assigned: libbna » Unassigned
Status: Needs work » Needs review
mstrelan’s picture

Status: Needs review » Reviewed & tested by the community

Changes look good to me.

FYI @libbna when there are suggestions on an MR you can just click "apply suggestion" and it will create a commit for you. You can also batch them up and apply them in a single commit too.

berdir’s picture

Sorry about this. I used some multi-line search & replace trickery to add the @deprecated to all template function in form.inc and that resulted in the extra _. Thanks for noticing and fixing it up.

libbna’s picture

Got it, @mstrelan — I’ll be mindful of this going ahead. Thanks!

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

berdir’s picture

Status: Needs work » Reviewed & tested by the community

Rebased, the media preprocess hook moved to MediaThemeHooks.

  • catch committed 2ce33992 on 11.x
    Issue #3534334 by berdir, libbna, nicxvan, catch, mstrelan: Convert...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

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