Paragraph Lineage provides a canonical path for paragraphs (only available to admins) that allows site content editors to see all the usages of a paragraph including all of the parent items all the way to a visible entity on the site (such as a node, taxonomy term, user, etc).
Use cases are determining if a change to a paragraph display or design will affect other elements on the site. To replace instances of one paragraph type for another and deleting the original, or other complex tasks that involve paragraphs on very large sites.
The module does not edit any content. It only provides read-only functionality.
Comments
Comment #2
vishal.kadamThank you for applying!
Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.
The important notes are the following.
Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
To the reviewers
Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.
The important notes are the following.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.
Comment #3
vishal.kadamComment #4
vishal.kadamRemember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.
Comment #5
chris dart commentedI have created a fork branch with the expected files. https://www.drupal.org/project/paragraph_lineage/issues/3528635
https://git.drupalcode.org/project/paragraph_lineage/-/merge_requests/11
Comment #6
vishal.kadamThe changes should be committed directly to the project repository. Please note that we do not review merge requests.
Make sure to fix the PHP_CodeSniffer errors/warnings reported by Gitlab CI.
Comment #7
avpadernoComment #8
vishal.kadam1. FILE: README.md
The README file is missing the required sections - Requirements and Configuration.
2. FILE: templates/paragraph-lineage.html.twig
<div class="field__label" aria-label="type">Type</div><div class="field__label" aria-label="paragraph-bundle">Bundle</div><summary>Preview</summary><h3>Lineage</h3><p>No ancestors available. This appears to be an orphan paragraph.</p>Strings shown in the user interface must be translatable. That holds true also for strings used in template files.
3. FILE: src/Controller/ParagraphLineageViewController.php
The parent class already has properties and methods for the entity type manager. There is no need to redefine properties for the same purpose; instead, the parent class methods should be used.
Comment #9
chris dart commentedThis is ready for review. I have updated the README.md, and the classes and the translation tags. https://git.drupalcode.org/project/paragraph_lineage/-/jobs
Comment #10
vishal.kadam1. Fix errors/warnings reported by phpcs and phpstan job of Gitlab CI.
2. FILE: templates/paragraph-lineage.html.twig
<div class="field__label" aria-label="type">Type</div><div class="field__label" aria-label="paragraph-bundle">Bundle</div><summary>Preview</summary><h3>Lineage</h3>Still some string are not translatable.
Comment #11
chris dart commentedI have fixed the lines I missed earlier. All strings should now be translated in the twig file.
Comment #12
vishal.kadamFILE: src/Plugin/Field/FieldFormatter/ParagraphIdLinkFormatter.php
$link_title = $this->t($label, ['@name' => $entity->label()]);The first argument passed to t() must be a literal string.
Comment #13
chris dart commentedI have fixed the issue with the $this->t() string literal concern.
Comment #14
vishal.kadamRest looks fine to me.
Please wait for a Project Moderator to take a look and if everything goes fine, you will get the role.
Comment #15
chris dart commentedIs there anything I need to do to help with this? Is there a way I can help review other applications for security review? Do I need to be approved to do this?
Comment #16
avpadernoTruly, this application should get reviewed by other reviewers too. A partial review is not sufficient to change the status to Reviewed & tested by the community.
Comment #17
bbu23Hi! Thank you for your contribution. Here's some additional feedback:
1. There are still unresolved phpcs issues (Standard and Practice).
2. I'm not a composer.json expert, but I don't think you are supposed to add this:
3. In the controller, the route match could be retrieved using the already available container instead of
$route_match = \Drupal::routeMatch();.4. The module provides a configuration page, but there's no
configure:key in the info file to the page route.5. While the
ParagraphLineageSettingsServiceservice seems to be providing a wrapper for retrieving and setting the module configuration, there are two observations:- The installation of the module provides a default value for the configuration, therefore the following code cannot happen:
- There can be issues with
getPreferredThemeId()when used inParagraphLineageSettingsForm. A configuration form when providing editable config names, it normally gets the editable configuration object. By using your service in the form, the default value is coming from an immutable configuration, which means that it can include overrides.6. The
$typedConfigManagerand$themeManagerarguments don't seem to be used in the service.7. In the
ParagraphIdLinkFormatter.phpfile, theviewElementsmethod, you are building an entity canonical Url using theUrl::fromRoute()approach, but when you have the entity object instance ofEntityInterface, you can use the entity to generate the Url. E.g.:8. Usually when defining plugins, it is recommended to prefix the IDs with your module's machine name to prevent conflicts with other modules. Your plugin IDs start with
fileandparagraph.9. It would be good to provide help page.
Comment #18
bbu23Comment #19
chris dart commentedThank you! I have fixed all of these items, but one I'm not sure I understand is this:
It is used only in read-only situations. Is there a feature in forms that would require this?
By the way, I know it is probably overkill to have a service for these settings. I often build a settings service for my modules because I often need to call the settings from multiple places. It's easier to track names and keep them abstracted in methods in one place. It's kind of future-proofing if I want to add and make available settings throughout my module (or other modules as the case may be). But maybe in this module it would be easier to just have the form handle getting and setting services like usual.
Comment #20
chris dart commentedComment #21
bbu23Thanks, Chris.
I like and understand the organization of the service. I'm just pointing out what can happen with overrides when used in an editable context. You can perform some tests by overriding the configuration in
settings.phpand see what happens when you edit the form. It's up to you if you want to do something about it or not.Comment #22
bbu23Actually, I see that you've already modified the service to:
Maybe you can update this to make it work for both cases. Something like:
This way, everything is covered. And in the settings form you call this with
getPreferredThemeId(TRUE). Otherwise, in its current form the overrides won't work at all outside the Settings form.Overrides apply to immutable configs. So, if someone wants to override the config in
settings.phpand you always retrieve the configuration as editable, they won't work.Comment #23
chris dart commentedI have updated the interface to use the code you suggested and added a UX help. I also added information indicating that the setting has been overridden in settings.php in the form interface. The user cannot change the setting because it is overridden.
Comment #24
bbu23Thanks, Chris.
Apparently there're still just a few warnings by phpcs. Other than that, everything else looks good to me.
Comment #25
chris dart commentedI have pushed up those changes you asked for and merged them to my main branch. Should be all good.
Comment #26
bbu23Sorry, Chris, you missed the warning about the
t()call inParagraphLineageSettingsForm.php.Comment #27
bbu23Just noticed something else in
paragraph_lineage.install: RemoveImplements hook_update_N().in the update functions descriptions. We don't want to see that text when running the updates.And just a side note, you should consider revisiting the doc page for the update hook numbers. Your hooks are running for D9 minimum (which is fine now, no change required), maybe in the future you want to consider increasing the core number.
Comment #28
chris dart commentedSorry I missed the one t(). I have fixed that. I have also removed the Implements lines in the install file.
Comment #29
bbu23Looks good to me.
Awaiting review by a Project Moderator.
Comment #30
chris dart commentedWhat are the next steps to getting this module approved?
Comment #31
chris dart commentedComment #32
avpadernosrc/Controller/ParagraphLineageViewController.php
Since that class does not use methods from the parent class, it does not need to use
ControllerBaseas parent class. Controllers do not need to have a parent class; as long as they implement\Drupal\Core\DependencyInjection\ContainerInjectionInterface, they are fine.There is no need to inject the route match, as that is passed to the method associated to a route, if one of its parameters is correctly typed, as described on Routing API.
src/Plugin/views/field/FileUsageParagraphLink.php
It is better to use
static(), as done from the other classes implemented by the module.Comment #33
chris dart commentedI have updated the code according to your request.
I have kept the ParagraphLineageViewController extending ControllerBase because it does use a number of methods from that including on line 157.
All create methods return static.
I have also checked through the other classes to make sure that they reflect the same requirements.
https://git.drupalcode.org/project/paragraph_lineage
Comment #34
avpadernoThank you for your contribution and for your patience with the review process!
I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.
These are some recommended readings to help you with maintainership:
You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank also all the reviewers for helping with these applications.
Comment #35
avpadernoComment #37
chris dart commentedThank you all!