Problem/Motivation

We are documenting service tags. In this issue, document the non-service_collector tags.

  • access_check needs work
  • backend_overridable
  • cache.bin
  • cache.context
  • encoder
  • entity_resolver
  • event_subscriber
  • http_middleware
  • needs_destruction
  • normalizer
  • persist
  • plugin_manager_cache_clear
  • render.main_content_renderer
  • route_enhancer
  • route_filter
  • stream_wrapper

Proposed resolution

Use @service_tag to document the service_collector tags. See #2264047: [meta] Document service definition tags.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cilefen’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.01 KB
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice!

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Um. Pretty sure that this needs a lot more work, if the issue summary is correct. :) Also:

+ *     - method: string | default: 'access' | ?

needs to not be a ? :)

cilefen’s picture

Yes, way not done yet.

cilefen’s picture

So, how are we going to document parameters?

I think:

*     - foo: string | default: 'bar' | Creates foos

Is not cool but I was just trying. Perhaps?

*     - foo: (string) Creates foos, default is 'bar'.

Thoughts?

webchick’s picture

Assigned: Unassigned » jhodgdon

Jennifer is usually the best person for those kind of questions. Not usually around on the weekends, though.

xjm’s picture

Priority: Critical » Major

So this issue was originally created as critical as a clone of #2264047: [meta] Document service definition tags which in turn was critical as part of #2238935: [meta] Complete missing documentation for special strings and metadata like annotation keys, routing parameters, tagged services, etc.. However, the API for service tags itself is already well-documented,Furthermore, you can discover what these services are for by looking at the services core provides (though having more central documentation on api.d.o will definitely make it easier to discover). I don't think we would block release on adding this documentation. Based on that, downgrading to major, if @jhodgdon agrees, because I do think the documentation on on api.d.o will be helpful.

sidharrell’s picture

Issue summary: View changes

updated the issue summary with all the locations I could find.

sidharrell’s picture

tagged all the locations with the patch, it's a little easier to work on now, I guess

sidharrell’s picture

added the "this tag is processed by" to all spots
and I think I didn't have the persist one saved before.

jhodgdon’s picture

Status: Needs review » Needs work

I don't think I was the one who decided any of these would be critical. ;} Fine with Major. Or even normal.

Anyway I took a quick look through the latest patch and it needs some work:

+ *   This tag is processed by
+ *   Drupal\Core\Cache\CacheContextsPass

Any time you use a class in docs it needs to start with \ and I think these can mostly all fit on one 80-character line as well?

Also please don't use gender pronouns:

+ *   A module developer has to tag his backend service with "backend_overridable":

Actually all of that documentation in the BackendCompilerPass looks like it is out of scope for this issue... if it is in scope it needs to all be rewritten and reformatted.

And for lists, like:

+ *   parameters:
+ *     - applies_to: string | The path requirements matching this check.
+ *     - method: string | default: 'access' | ?
+ *     - needs_incoming_request: bool | default: TRUE

Please read the list formatting guidelines:
https://www.drupal.org/node/1354#lists

Obviously the @todo parts need to be done too.

sidharrell’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
11.84 KB
11.17 KB

I found this in entity.api.php:

 *   - translatable: (optional) A boolean value specifying whether this bundle
 *     has translation support enabled. Defaults to FALSE.

So I'm going to use that as the template for the parameters.

I inserted the "\"s and moved those that would fit under the 80 char limit to one line.

"I didn't do it!!" I just moved that text under the service tag that was already in that class header. I moved it back to where it was, but I did change it to remove the gender pronoun.

I reworked the parameter list as best I could to conform to the standards you pointed to.

For all the stuff that's marked @todo, I think you really need someone other than me to do that writing. This is only my second week in Drupal, and while I'm loving what I've learned so far, and more than happy to help out with moving some of these tickets along, I'm probably not qualified to speak to the content of each of these.
It would probably only take the right person 2 minutes or less to write a blurb on each one.

cilefen’s picture

Status: Needs review » Needs work

@sidharrell That's good work for your first two weeks. Here is a mini review of what you have so far.

  1. +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php
    @@ -14,7 +14,7 @@
    + * A module developer should tag their backend service with "backend_overridable":
    

    If you are changing this from 'has to', I would go with 'must'.

  2. +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php
    @@ -14,6 +14,12 @@
    + *   To define a stream wrapper service, it should be tagged with 'stream_wrapper',
    + *   either statically or dynamically. See @link https://www.drupal.org/node/2393323 CR.
    

    Don't exceed 80 characters except for long class names.

  3. +++ b/core/modules/serialization/src/RegisterSerializationClassesCompilerPass.php
    @@ -13,6 +13,14 @@
    + * @service_tag encoder
    + *   @todo  fill this in
    + *   This tag is processed by
    

    There should be newlines around these @service_tag blocks. That goes for all of them.

I like the parameter style you went with. Let's see what Jennifer thinks. I agree someone more expert in these service definitions should document them. I will see if I can glean what some of them do. Keep it up!

sidharrell’s picture

Status: Needs work » Needs review
FileSize
11.27 KB
9.38 KB

Did 1 and 3.
For #2, I tidyed up that bit, but it's probably going to get rewritten alot. When you say "except for long class names", does that mean like the "This tag is processed by" lines, or should those still be broken up if they go over 80?

cilefen’s picture

+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php
@@ -35,6 +35,10 @@
+ *   This tag is processed by \Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass.

Yes, in a case like this I think we are supposed to put the class name on its own line, in order to avoid exceeding 80 as much as possible.

+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/StackedKernelPass.php
@@ -13,8 +13,11 @@
- *

There is always a new line after the one-line summary.

It's true we don't want to be too nit-picky at this stage, but it doesn't hurt to get as much done as we can. Check out the comment standards.

jhodgdon’s picture

Title: Document non-service collector tags » Document service tags, other than those related to service collectors
Status: Needs review » Needs work

#15 is correct. And yes let's be nit-picky at all points. ;)

And thanks for working on these patches!

Speaking of nitpicks... Aside from the @todo notes, and the comments in #15, here are a few more things that can be fixed by someone without specialized Drupal knowledge:

a)

+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterAccessChecksPass.php
+ * @service_tag access_check
+ *   Services that check access to routes must be tagged access_check to be
+ *   registered to the access_manager service. There are three parameters:
+ *     - applies_to: (optional) A string specifying the path requirements
+ *       matching this check. Defaults to @todo.
+ *     - method: (optional) A string @todo that does something. Defaults to
+ *       'access'.
+ *     - needs_incoming_request: (optional) A boolean specifying @todo. Defaults
+ *       to TRUE.

List formatting - the indentation is incorrect. See https://www.drupal.org/node/1354#lists

b)

+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterKernelListenersPass.php
@@ -10,6 +10,12 @@
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
 
+/**
+ * @service_tag event_subscriber
+ *   @todo fill this in
+ *   This tag is processed by \Drupal\Core\DependencyInjection\Compiler\RegisterKernelListenersPass.
+ */
+
 class RegisterKernelListenersPass implements CompilerPassInterface {

Wow. This class doesn't have a docs header. That is really bad. Can we at least just add one line of docs header for this class, and then put the @service_tag inside that docs header, rather than putting the @service_tag part separate from the class declaration?

c)

+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php
@@ -14,6 +14,13 @@
 
 /**
  * Adds services tagged 'stream_wrapper' to the stream_wrapper_manager service.
+ *
+ * @service_tag stream_wrapper
+ *   To define a stream wrapper service, it should be tagged with
+ *   'stream_wrapper', either statically or dynamically. See
+ *   @link https://www.drupal.org/node/2393323 CR. @endlink
+ *   @todo update and revise
+ *   This tag is processed by \Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass.
  */
 class RegisterStreamWrappersPass implements CompilerPassInterface {
 

I wouldn't use the word "should". This is actually a requirement. So say "Services that provide stream wrappers must be tagged with...". I think I'd also remove the "either statically or dynamically" part, what does that even mean?

Also when putting links to drupal.org or other web sites in documentation, it is not necessary to use @link. Just do something like:

* See https://www.drupal.org/whatever for more information.
sidharrell’s picture

Did #15 and #16 a, b, and c.
For c, I got it from that CR.

To define a stream wrapper that is always available, define it in yourmodule.services.yml like this:

and

If a stream wrapper should only be available dynamically, like private://, use a ServiceProvider:

I thought it was a pretty cool feature, so wanted to make some mention in the api docs.

Thanks for letting me work on this stuff. I enjoy it, I'm learning a lot, and hopefully I'll be a consumer of the api docs if I can get some consulting work with D8 after it's released.

jhodgdon’s picture

Latest changes look good! Of course the patch still needs work for the @todo items.

cilefen’s picture

+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterKernelListenersPass.php
@@ -2,7 +2,8 @@
- * Definition of Drupal\Core\DependencyInjection\Compiler\RegisterKernelListenersPass.
+ * Definition of
+ * Drupal\Core\DependencyInjection\Compiler\RegisterKernelListenersPass.

For whoever makes the next patch: If we are fixing this, it should read "Contains Drupal\Core...". The @file short comment must be on one line and if it is too long because the class name is long, so be it. It is a special case as far as I know.

cilefen’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
2.54 KB
12.73 KB
jhodgdon’s picture

Status: Needs review » Postponed

There are still numerous @todo lines in the comments here.

Also, actually the parent issue has not been formally agreed to as the standard for how to do this and this should be postponed until it is.

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

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should 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.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.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.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.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.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.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.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

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

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.