Problem/Motivation

Quoting @jhodgdon from #1968970-13: Standardize module-provided entity info documentation and clean-up the @EntityType annotation [wrt to the docblock of EntityTranslationControllerInterface]:

- How about a @defgroup so it shows up as a Topic?

- This @file doc starts out "The entity translation UI relies on the entity info to provide its features." and then doesn't explain what "entity info" is or how to define it (a hook? plugin annotation?).

- Then the next paragraph starts out telling me that some keys are required but not all, and then gets really really confusing so that I can't even follow it. I think it would be better to just make a list of the keys (using our standard list formatting to indicate (optional) for optional keys and explaining for each key why/when it is really optional).

- The rest of the documentation in the @file just seems like a ramble... it really needs to be organized.

So... Can the documentation be rewritten so that it
a) Is in a @defgroup not @file, with relevant classes/hooks/whatever using @ingroup so they reference each other?
b) Actually tells a developer what they need to do to define a translatable entity class.
c) Is in a logical order.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-1985232

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

plach’s picture

Title: The translation_entity module documentation is currently a mess » The Content Translation module documentation is currently a mess
Assigned: Unassigned » jhodgdon
Issue summary: View changes

@jhodgdon:

That docblock has been considerably reduced (and moved to the content_translation_entity_info_alter() PHP docs), since this issue was open: would you please give it another look before we start any work here?

jhodgdon’s picture

Title: The Content Translation module documentation is currently a mess » Docs for how to make an entity translatable are a mess and not discoverable

IMO, putting all of that information into content_translation_entity_info_alter() is not useful at all. How would someone know where to find it? My main concern above still stands -- the docs need to be in a @defgroup and not in some obscure location.

And I also still think the docs need to be rewritten. They are kind of just a jumble of thoughts in no particularly logical order. Who is the audience for this documentation? What would a logical title be? What does this audience need to know?

So I think most of what I said earlier still applies.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
plach’s picture

@jhodgdon:

In #1968970-18: Standardize module-provided entity info documentation and clean-up the @EntityType annotation you suggested to move them there:

c) And then I think each class that does this should define its annotation keys in its hook_entity_info(_alter) docs maybe? Does that make sense?

I think that place makes sense as the whole docblock describes entity info keys. If you don't agree I guess we need to revert #1968970: Standardize module-provided entity info documentation and clean-up the @EntityType annotation as this issue was only meant to improve the doc content.

jhodgdon’s picture

OK then. For this issue, let's ignore the "how will people discover this" piece and at least rewrite the documentation so that it makes sense.

jhodgdon’s picture

Ah. And I see that on that other issue's patch, some documentation pointers were made to hook_entity_info() and hook_entity_info_alter(), so people should know to look there. Should be fine.

jhodgdon’s picture

Title: Docs for how to make an entity translatable are a mess and not discoverable » content_translation_entity_info_alter() docs need reorg/rewrite
plach’s picture

Awesome, I will try to put something together later :)

plach’s picture

Status: Active » Needs review
Issue tags: +D8MI, +language-content
StatusFileSize
new2.54 KB

Here is a first attempt: CT entity info have been simplified quite a bit since that docblock was originally written, so there is way less stuff to document :)

I omitted the 'translation' key as it is obsolete and it will be removed ASAP.

jhodgdon’s picture

Status: Needs review » Needs work

Yes, does seem to be simpler -- DX->simple() == good.

So... I think this is pretty good, but it could be improved:

a) The documentation starts out by saying that the entity info needs two entity info items and then goes on to say in the details of each one that they're actually optional. I found it a bit confusing.

b) The second item refers to "link templates" but in the entity info, I think these are actually in the "links" section. I think it's probably better to use the actual element name?

c) For more novice developers, it might be good to mention annotation in the first paragraph explicitly? Maybe rather than saying "needs two entity info items" it would be better to say something like "references two elements from the EntityType annotation in the entity class documentation header"? It's a few more words but might save some head scratching.

d) It's obvious if you read the code in this info_alter function, but maybe it should be mentioned that the entity type's isTranslatable() method needs to return TRUE... and I personally am not sure how to make sure that happens (maybe it's that the "translatable" element in the EntityType is set to TRUE?)... maybe it would be a good idea to explain that too? or how to make it not happen, if for some reason you do not want your entity to be translatable?

jhodgdon’s picture

By the way, and maybe this should be back on the other issue... Where are all of the things that go into @EntityType actually documented anyway?

I went to

https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityType... (the annotation class, I think, for @EntityType annotation?)

and there is not a link to hook_entity_info_alter() and there isn't much at all there in that annotation class. How again is someone supposed to discover where to discover all the @EntityType elements?

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.

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.

darvanen’s picture

Traiged as part of the Bug Smash Initiative (#bugsmash on slack). Determined to still be a bug due to misleading documentation.

Needs a reroll, and the IS needs the template applied and filled out.

immaculatexavier’s picture

Status: Needs work » Needs review
StatusFileSize
new3.83 KB
new5.23 KB

Rerolled patch against #9

medha kumari’s picture

Version: 9.4.x-dev » 9.5.x-dev
Issue tags: -Needs reroll
StatusFileSize
new3.84 KB

Reroll the patch #24 with Drupal 9.5.x

medha kumari’s picture

Version: 9.5.x-dev » 10.1.x-dev
StatusFileSize
new3.84 KB

Reroll the patch #24 with Drupal 10.1.x

smustgrave’s picture

Status: Needs review » Needs work

For issue summary update.

Version: 10.1.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, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone made their first commit to this issue’s fork.

quietone’s picture

Title: content_translation_entity_info_alter() docs need reorg/rewrite » content_translation_entity_info_alter() docs need rewrite
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update

Lets see if we can complete this.

smustgrave’s picture

Status: Needs review » Needs work

So looking at the quote of the summary talks about adding @defgroup but that's not the case. So is the goal just to rewrite it now?

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.