Problem/Motivation

Theme functions no longer exist in Drupal 9, but the documentation for these functions still appears in theme.api.php.

theme.api.php is used to generate the Theme system overview documentation on api.drupal.org.

Proposed resolution

Remove obsolete documentation.

API changes

None.

Data model changes

None.

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new10.81 KB
tr’s picture

Issue tags: +Bug Smash Initiative
longwave’s picture

This can't actually happen until 10.x opens because theme functions, while deprecated, still work in 9.x (I originally wrote "supported" but that sounds like they might be a good idea, when they are definitely not).

#3097889: Remove deprecated theme functions already has a patch to remove the supporting code and documentation.

longwave’s picture

Good to see that we came to roughly the same end result when updating theme.api.php though :)

tr’s picture

Theme functions were deprecated all the way back in 8.0.0, but actually using them in D9 causes PHP to load the dblog with tracebacks.

I didn't realize they weren't fully removed until D10. After all, theme.api.php itself says theme functions "are deprecated in Drupal 8.0.x and will be removed before ​Drupal 9.0.x", but nevertheless IMO we shouldn't be documenting how to use deprecated things in an API overview document like this.

Really, this documentation should have been removed in D8. And certainly in D9! Why wait until D10? The .api.php documentation is different from documentation for deprecated functions, classes, or methods, as those are tied to the code itself. Rather, the .api.php documentation is supposed to show how to use the hooks/API defined by a module. For theme.api.php, it's a high-level overview of the theming system - we certainly do NOT want to be teaching people how to use theme functions at this point. For reference on legacy use, they can go back to the D8 documentation, but for the D9 documentation why would we want to keep explaining how to use theme functions?

vikashsoni’s picture

StatusFileSize
new148.67 KB

I have checked this patch in drupal-9.3.x-dev working fine after patch documentation removed

for ref sharing screenshot ...

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

> Rather, the .api.php documentation is supposed to show how to use the hooks/API defined by a module.

That's true, but a developer looking at a D9 codebase which uses deprecated theme functions is also going to read the .api.php documentation to understand what the code is doing.

joachim’s picture

Status: Reviewed & tested by the community » Needs review

Oops, didn't mean to change the status!

tr’s picture

Version: 9.4.x-dev » 10.0.x-dev

It really shouldn't take 7+ years to get rid of obsolete documentation. Especially since making regressive API changes in core can be done in under a month.

This is just one of the reasons why Drupal documentation sucks and keeps getting worse - there's no community will to do anything to fix it.

joachim’s picture

I totally understand your frustration, but the problem here is the code, not the docs. If the code is still working in 9.x because we forgot to remove it in 9.0, then the docs need to describe it.

(And I actually think that Drupal's code docs are way better than most of the PHP packages I see out there.)

tr’s picture

Yeah, I'm frustrated because even the simplest bugs with documentation take years to fix. Years. For example, I participated in a bug report that's been open for > 5 years and has been RTBC for >3 years. DrupalCI tests it every two days, wasting real DA money. It fixes a missing return type in documentation. More than 5 years, and still broken. How many Drupal developers does it take to screw in a light bulb?

80% of my core issues are > 4 years old. Some are 15 years old. If the simple things can't be fixed without endless bikeshedding, then really what hope do we have for making better documentation? I don't even try to contribute to core much anymore, because experience shows that any effort I make will likely be wasted. I'm sure I'm not the only one who feels this way.

The above patch still applies in D10. There is no question (I hope) that theme functions are gone in D10, and that the documentation should be fixed. This is something that can be committed NOW which will improve the documentation without affecting anybody at all.

longwave’s picture

In 10.0.x we can remove both the documentation and the code, so I think this is now a duplicate of #3097889: Remove deprecated theme functions?

andypost’s picture

Status: Needs review » Reviewed & tested by the community

I think it ready, it should not have collisions with removal re #15

longwave’s picture

#3097889: Remove deprecated theme functions removes both the code and the docs - we usually do them together?

catch’s picture

Status: Reviewed & tested by the community » Postponed

We could potentially keep this open as a 9.4.x backport of #3097889: Remove deprecated theme functions, but definitely that issue is the one to go ahead with in 10.0.x

Marking postponed for now, then we can decide whether to mark as duplicate or leave open as the backport issue (since there's discussion on here about whether to keep the documentation or not, personally I'd remove it in 9.4.x too).

andypost’s picture

Status: Postponed » Needs review

It could also add changes from #3262500-18: Mark drupal_find_theme_functions() @internal in Drupal 9 as blocker commited

andypost’s picture

Status: Needs review » Reviewed & tested by the community

no need to add, back to rtbc

catch’s picture

Version: 10.0.x-dev » 9.4.x-dev

  • catch committed 289fbfc on 9.4.x
    Issue #3224178 by TR, vikashsoni, longwave, joachim, andypost: Remove...
catch’s picture

Status: Reviewed & tested by the community » Fixed

I agree with removing this documentation, for several reasons:

1. Theme functions are entirely obsolete, we didn't even recommend them when 9.0.0 was released.

2. The documentation for theme functions will still be in 9.x branches 9.3.x and lower.

3. This is high-level 'topic' API documentation for new developers, it needs to be concise and accurate. While it might be technically true that the 9.x theme layer supports theme functions, there is not good reason for anyone to encounter them, and as with #1 and #2 there are other places to find out. It's a bit like we also shouldn't document buggy behaviour (except very rarely with a @todo).

Committed 289fbfc and pushed to 9.4.x. Thanks!

Status: Fixed » Closed (fixed)

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

bnjmnm’s picture