Problem/Motivation

#3041924: [META] Convert hook_help() module overview text to topics for the file, image, media, media_library, responsive_image module(s).

Proposed resolution

Take the information that is currently in the hook_help module overview section for the module(s), and make sure the information is in one or more Twig help topic files. Steps:

  1. Find the hook_help() implementation function in the core/modules/MODULENAME/MODULENAME.module file(s). For example, for the core Contact module, the module files is core/modules/contact/contact.module, and the function is called contact_help().
  2. Locate the module overview portion of this function. This is located just after some lines that look something like this:
      switch ($route_name) {
        case 'help.page.contact':
    

    And ends either at the end of the function, or where you find another case 'something': line.

  3. We want to end up with one or more topics about the tasks that you can do with this module, and possibly a section header topic. So, read the help and figure out a good way to logically divide it up into tasks and sections. See Standards for Help Topics for information on how to do this.
  4. See if some of these tasks are already documented in existing topics. Currently, all topics are in core/modules/help_topics/help_topics. Note that to see existing topics, you will need to enable the experimental Help Topics module (available in the latest dev versions of Drupal 8.x).
  5. For each task or section topic that needs to be written, make a new Twig topic file (see Standards for Help Topics) in core/modules/help_topics/help_topics. You will need to choose the appropriate module prefix for the file name -- the module that is required for the functionality. Alternatively, if the information spans several modules or if the information should be visible before the module is installed, you can use the "core" file name prefix. For instance, it might be useful to know that to get a certain functionality, you need to turn on a certain module (so that would be in the core prefix), but then the details of how to use it should only be visible once that module is turned on (so that would be in the module prefix).
  6. File names must be MODULENAME.TOPICNAME.html.twig -- for example, in the Action module, you could create a topic about managing actions with filename action.managing.html.twig (and "MODULENAME" can be "core" as discussed above).
  7. Make a patch file that adds/updates the Twig templates. The patch should not remove the text from the hook_help() implementation (that will be done separately).

Remaining tasks

a) Make a patch (see Proposed Resolution section).

b) Review the patch:

  1. Apply the patch.
  2. Turn on the experimental Help Topics module in your site, as well as the module(s) listed in this issue.
  3. Visit the page for each topic that is created or modified in this patch. The topics are files in the patch ending in .html.twig. If you find a file, such as core/modules/help_topics/help_topics/action.configuring.html.twig, you can view the topic at the URL admin/help/topic/action.configuring within your site.
  4. Review the topic text that you can see on the page, making sure of the following aspects:
    • The text is written in clear, simple, straightforward language
    • No grammar/punctuation errors
    • Valid HTML -- you can use http://validator.w3.org/ to check
    • Links within the text work
    • Instructions for tasks work
    • Adheres to Standards for Help Topics [for some aspects, you will need to look at the Twig file rather than the topic page].
  5. Read the old "module overview" topic(s) for the module(s), at admin/help/MODULENAME. Verify that all the tasks described in these overview pages are covered in the topics you reviewed.

User interface changes

Help topics will be added to cover tasks currently covered in modules' hook_help() implementations.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Comments

James.Shee created an issue. See original summary.

james.shee’s picture

StatusFileSize
new4.77 KB

First pass, converted the whole media_help function into help topic twig template

benjifisher’s picture

Status: Postponed » Needs work

@James.Shee:

Thanks for starting this!

+{% set media = 'https://www.drupal.org/docs/8/core/modules/media' %}
+{% set media_type = render_var(url('entity.media_type.collection')) %}
+{% set media_collection = render_var( url('entity.media.collection')) %} 
+{% set media_new = render_var( url('entity.media_type.add_form')) %}
+{% set field = render_var( url('help.page', {name: 'field'})) %}
+{% set permissions = render_var( url('user.admin_permissions', {}, {fragment: 'module-media'})) %}

There is some inconsistency there with white space: we should get rid of the space after some of the opening parentheses (().

This is the first time today I have seen the third parameter to the Twig url() today.

+<h3> {% trans %} About {% endtrans %} </h3>

I think we should get rid of a lot of the white space. (This line is just an example.) Keep the space after {{ and {% and before %} and }}, but not before and after the HTML tags and within the translation directives.

\ No newline at end of file

According to the Drupal coding standards,

All text files should end in a single newline (\n). This avoids the verbose "\ No newline at end of file" patch warning and makes patches easier to read since it's clearer what is being changed when lines are added to the end of a file.

See if you can configure your text editor/IDE so that you do not have to think about this ever again. For example, if your editor/IDE respects the EditorConfig standard, then Drupal's .editorconfig will automate some of these standards.

kkalaskar’s picture

StatusFileSize
new4.75 KB
kkalaskar’s picture

Status: Needs work » Needs review
kkalaskar’s picture

StatusFileSize
new4.74 KB

Previous patch (#5) was wrong. Adding new one.

jhodgdon’s picture

Status: Needs review » Postponed

We need to postpone this until the #2920309: Add experimental module for Help Topics gets committed. No idea when/if that might happen right now...

chr.fritsch’s picture

Status: Postponed » Needs review

Unblocked

jhodgdon’s picture

Title: Convert media module hook_help() to topic(s) » Convert file, image, media, media_library, responsive_image module hook_help() to topic(s)
Issue summary: View changes
Status: Needs review » Needs work

Adding more media-related modules to this issue, so it will need more in the patch (have not reviewed the existing patch yet).

jhodgdon’s picture

Issue summary: View changes

Updated issue summary with better instructions/guidelines

jhodgdon’s picture

Issue summary: View changes

And one more iteration on the guidelines.

jhodgdon’s picture

Issue summary: View changes

We've migrated the help topic standards to https://www.drupal.org/docs/develop/documenting-your-project/help-topic-... so updating issue summary again.

volkswagenchick’s picture

Issue tags: +badcamp2019

Tagging this for badcamp2019. (October 2-5)

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jhodgdon’s picture

Issue summary: View changes

We just found out that all topic Twig files currently need to go into core/modules/help_topics/help_topics (with their finalized module-based file names), for the time being until the Help Topics module is stable. Updating issue summary. Patch will need to be updated too.

jhodgdon’s picture

Issue summary: View changes
jhodgdon’s picture

Status: Needs work » Postponed

I think we should probably postpone this issue until #3087562: Convert datetime, datetime_range, field, field_ui, link, options, telephone, text modules hook_help() to topic(s) is finished, because that module is providing an overview topic that talks about fields, which I think this issue will need to either add to or reference or both.

jhodgdon’s picture

jhodgdon’s picture

Status: Postponed » Needs work

The field/entity issue was committed, so this does not need to be postponed any more!

jhodgdon’s picture

Assigned: Unassigned » jhodgdon

The patch in #7 is basically a cut/paste of the existing hook_help for the media module, so I don't think it's a very useful starting point.

So, I'm trying to figure out what topics we actually need for this set of modules. Some thoughts:

a) It seems like we want to recommend using the Media module fields (which are Media Reference fields), rather than File or Image module fields, on content types. We already have "Reference" fields listed as a field type on core.content_structure topic, and Media listed as a content entity type in that topic.

b) We probably need a topic called "Managing media", which would be related to core.content_structure, and probably it would be an overview top-level topic. In this area, we need to cover:
- What is media? (images and other files)
- What is a media library?
- What the various modules do
- How to set up a media field and the media library (if it's different from adding a reference field in general; otherwise just link to the field_ui.reference_field topic that already exists)
- How to set up an image style
- How to set up responsive images

I'll work on writing these topics

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
StatusFileSize
new4.71 KB

Here is a start of a patch. It still needs some topics to be written. I'm unassigning this for the moment; will get back to it in a day or two if no one else does.

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

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

jhodgdon’s picture

Status: Needs work » Postponed
StatusFileSize
new6.99 KB

I did some more work on this patch, but when I got to the topic about responsive image styles, I realized it needed to refer to help on breakpoints in order to continue. So, I think we should postpone this issue until #3055055: Convert appearance-related modules: breakpoint, color, layout_builder, layout_discovery module hook_help() to topic(s) is done.

I did manage to get part of that topic written, as well as the topic about image styles, so I'm uploading my partially-done patch in the meantime.

jhodgdon’s picture

Status: Postponed » Needs work

This does not need to be postponed any more, as the blocking issue is now fixed. I'll make a new patch in the next few days.

jhodgdon’s picture

Issue tags: -Novice

Taking the Novice tag off this issue. It really isn't, at least until we get to the review stage.

jhodgdon’s picture

Status: Needs work » Needs review
Issue tags: +Novice, +Global2020
StatusFileSize
new10.64 KB

I made a patch for this, now with all the topics. Ready for review! Adding back the Novice tag and Global2020, as a review (following instructions in the issue summary) would be the next step.

mfv’s picture

#27 Patch Installed with no issues.

Here are some of my findings:

image.style.html.twig:

Instructional text suggestions:

5. Configure the effect on the next page, this applies to most effects. For example, for the Crop effect, enter the Width and Height to crop the image to, and choose the Anchor point. Click Add effect.

7. Drag to change the order of the effects, if necessary. Then click Save to save the new order.

8. The image style can now be used to format a field containing an image, in your layouts or traditional field displays. It can also be used as part of a responsive image style. See related topics below for more information.

core.media.html.twig

twig:

line 15: "<p>{% trans %}The media library is a visual user interface for managing media items and reusing them in Media reference fields, via the Media library field widget.{% endtrans %}</li>" needs a closing </p> tag

jhodgdon’s picture

Status: Needs review » Needs work

Thanks for the review! Setting this to Needs work accordingly.

ashishdalvi’s picture

jhodgdon’s picture

Issue tags: +Seattle2019, +badcamp2019

Please don't remove previous event tags when adding new ones, thanks!

ultrabob’s picture

Assigned: Unassigned » ultrabob
ultrabob’s picture

Assigned: ultrabob » Unassigned

I'll try to move this one forward. I'm in #contribute on drupal slack while I work on this for #Global2020

nuklive’s picture

I'll be reviewing ultrabob's patch

ultrabob’s picture

StatusFileSize
new10.61 KB
new3.31 KB

I've addressed the issues raised in the review of 27, with some minor edits that I think make the text read more clearly.

ultrabob’s picture

Status: Needs work » Needs review
StatusFileSize
new10.67 KB
new3.81 KB

One of my changes somehow got left out of the previous patch, so I'm redoing it.

Steps to test: enable experimental help topics module and the media module, then visit /admin/help/topic/image.style and /admin/help/topic/core.media to verify.

nuklive’s picture

1) Patch applies cleanly to 9.1.x.
2) Following the instructions to test the patch I was able to access the new help topic pages
3) I verified that the text is simple and understandable, links work and the instructions are clear, English is my second language, so I checked grammar/punctuation errors with a spellchecker

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the review! Looks good to me too. Based on reviews of @nuklive and @mvf (whose comments have been addressed), I think we can set this to RTBC now.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 36: 3047711-36.patch, failed testing. View results

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated fail:
Drupal\Tests\media_library\FunctionalJavascript\WidgetUploadTest::testWidgetUploadAdvancedUi
"image-1.png" not found

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 36: 3047711-36.patch, failed testing. View results

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated fail in Drupal\Tests\quickedit\FunctionalJavascript\QuickEditIntegrationTest

catch’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/help_topics/help_topics/core.media.html.twig
    @@ -0,0 +1,30 @@
    +{% set structure = render_var(url('help.help_topic', {'id': 'core.content_structure'})) %}
    +<h2>{% trans %}What are media items?{% endtrans %}</h2>
    +<p>{% trans %}Media items include images, documents, slideshows, videos, and Tweets. They may be files located in your site's file system, or remote items referenced by a URL. Media items are content entities, and they are divided into media types (which are entity sub-types); media types can have fields. See the <a href="{{ structure }}">Managing content structure</a> topic for more information on content entities and fields.{% endtrans %}</p>
    +<h2>{% trans %}What is the media library?{% endtrans %}</h2>
    

    We shouldn't use 'entity sub-type' here - it's not used in core, and there are old core issues to introduce the concept (differently to bundles) - would either remove the parenthetical altogether, or change it to 'bundles'.

    Separately - do we have twitter support in core? If not I don't think we should list it.

  2. +++ b/core/modules/help_topics/help_topics/core.media.html.twig
    @@ -0,0 +1,30 @@
    +<ul>
    +  <li>{% trans %}Media items and media types are managed by the core Media module.{% endtrans %}</li>
    +  <li>{% trans %}The core Media module provides a Media reference field that you can add to other content entities; the core File and Image module also both provide reference fields, but it is recommended to use the more versatile Media reference field instead.{% endtrans %}</li>
    +  <li>{% trans %}The core Media Library module provides the media library and the Media library field widget. If you have this module installed, the Media library field widget is the default widget for editing Media reference fields.{% endtrans %}</li>
    

    I scanned over this sentence too quickly, and it read like I should use the media reference field instead of the media reference field - could we re-order - like 'You should normally use the media reference field instead of image and file fields'?

jhodgdon’s picture

Thanks for the review!

If we're not using the terminology "entity sub-type", what are we using? If there is an alternate terminology that is better, we need to update the already-committed core.content_structure topic (which is referenced here for this terminology), and anywhere else in other existing topics that uses this terminology. Also the User Guide, which also uses this terminology. For now, let's punt this terminology question to #3121340: Fix up minor copy problems in help topics.

So, we need a patch that:
(a) removes mention of Tweets
(b) rearranges the confusing sentence
in the core.media topic (see previous comment for details).

ultrabob’s picture

OK, let me try to get that done.

ultrabob’s picture

StatusFileSize
new10.91 KB
new5.02 KB

I made the suggested changes, and then went ahead and did some more simplifying and readability editing on the text. I also shortened the long lines of text into manageable chunks in the source. I probably should have done that with the other files too.

jhodgdon’s picture

Please reverse those changes. These are translatable strings, and having them broken up into lines is actually not helpful. It also makes the interdiff very difficult to review. So, if you could please make another patch with all the single-text strings in single lines again, and make an interdiff from the previous patch, that would be helpful. Thanks!

catch’s picture

One of the related issues: #1380720: Rename entity "bundle" to "subtype" in the UI text and help.

IMO we should just use 'bundle', unless we rename bundle to something else. But 'entity sub-type' is not self-explanatory to me, so it's really adding an additional concept on top of bundle for people to understand, as opposed to explaining what a bundle is.

jhodgdon’s picture

OK I'll link that on the other issue, but we already have a number of topics... We would either have to use the term "bundle" and explain it, or use the term "entity sub-type" and explain that. New users of Drupal do not understand either "entity" or "bundle" or "type and sub-type". Again, let's for now be consistent within the topics (and the user guide) and fix it at the end in all the topics, not hold this issue up on something that was already done.

ultrabob’s picture

StatusFileSize
new10.69 KB
new5.04 KB

Sorry about the formatting thing. I've reverted that, fixed a typo, and also removed the parenthetical about entity sub-type because I tend to agree that it isn't adding much besides establishing the phrase "entity sub-type" for the Related Topics list at the bottom.

I thought that alternately, that sentence could be phrased as something like

Media items are derivatives of content entities (entity sub-types), divided into media types.

to kind of define entity sub-type inline there.

jhodgdon’s picture

StatusFileSize
new4.69 KB

Here's an interdiff between the patch in #36 and the patch in #50. I took a look at that interdiff, and have the following comments, all related to the one file that was changed (core.media.html.twig):

a) Nitpick: please only 1 space after a . Occurs in several places throughout this interdiff.

b) Nitpick: I don't think media should be capitalized here: "Core Media items ..."

c) As noted in #44, the already-existing topic on content structure, which is referenced/linked in this topic, already uses the terminology of entity sub-types, and I've added a to do to #3121340: Fix up minor copy problems in help topics to revisit that decision. The decision will also be discussed on #1380720: Rename entity "bundle" to "subtype" in the UI text and help (and it looks like "sub-type" is likely to be the decision there]. Until that happens, we should continue to use the terminology so that the entire set of help topics that deals with content entities is consistent.

d) Nitpick: please remove the blank line in the template here:

+<p>{% trans %}An image style is a set of processing steps, known as <em>effects</em>, that can be applied to images. Examples of effects include scaling and cropping images to different sizes. Responsive image styles can associate image styles with your theme's size breakpoints.  This allows serving images sized for the browser width.{% endtrans %}</p>
+
 <h2>{% trans %}Overview of managing media{% endtrans %}</h2>
jhodgdon’s picture

The "entity sub-type" terminology has been agreed to at the Usability group meeting, on #1380720: Rename entity "bundle" to "subtype" in the UI text and help.

ultrabob’s picture

I don't know when or if, I'll find time to make another patch for this, but to clarify on the new agreement on subtype, are you now suggesting that sentence should read something like:

Media items are content entity subtypes, divided into media types.

?

jhodgdon’s picture

I suggest we go back to the wording in the patch in #36: "Media items are content entities, and they are divided into media types (which are entity sub-types);..."

shetpooja04’s picture

Status: Needs work » Needs review
StatusFileSize
new10.72 KB
new4.46 KB

I have uploaded the patch with the changes suggested in #51
Please review, Thank you

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me! I think the concerns in comments 43-52 have been addressed, given that the decision on #1380720: Rename entity "bundle" to "subtype" in the UI text and help from the Usability team is that we should keep the "entity sub-type" terminology that is already in place on the content structure topic (and not use the term "bundle").

Thanks for the patches!

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

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

The last submitted patch, 50: 3047711-50.patch, failed testing. View results

jhodgdon’s picture

QuickEditIntegrationTest again. But why is the patch on #50 instead of #55 being tested regularly???

jhodgdon’s picture

That comment seems to have reset the bot, so the correct patch should be retested now.

jhodgdon’s picture

Issue tags: -Novice

This should not really be a Novice issue

  • catch committed 40887e9 on 9.2.x
    Issue #3047711 by ultrabob, jhodgdon, kkalaskar, shetpooja04, James.Shee...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 40887e9 and pushed to 9.2.x. Thanks!

Status: Fixed » Closed (fixed)

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

catch’s picture

And cherry-picked to 9.1.x