[1.0.x] Paragraph Locator

Created on 11 July 2024, 5 months ago
Updated 11 September 2024, 3 months ago

This module is designed to help Drupal administrators and content managers efficiently manage paragraph types and their usage within the site. Below, you'll find detailed information on how to use the various features of this module.

Project link

https://www.drupal.org/project/paragraph_locator →

📌 Task
Status

Fixed

Component

module

Created by

🇮🇳India deepak5423

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @deepak5423
  • 🇮🇳India vishal.kadam Mumbai

    Thank 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.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    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.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool → only once per application.
    • It may be best to have the applicant fix things before further review.

    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 → .

  • 🇮🇳India vishal.kadam Mumbai
  • 🇮🇳India vishal.kadam Mumbai

    Remember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.

  • Status changed to Needs review 5 months ago
  • 🇮🇳India deepak5423

    I have made the changes. The project is now ready to be reviewed.

  • Status changed to Needs work 5 months ago
  • 🇮🇳India vishal.kadam Mumbai

    1. FILE: paragraph_locator.info.yml

    core_version_requirement: ^8 || ^9 || ^10

    The Drupal Core versions before 8.7.7 do not recognize the core_version_requirement → key.

    2. FILE: paragraph_locator.libraries.yml

    # custom_module.libraries.yml

    Remove commented code.

    3. FILE: paragraph_locator.module

    /**
     * @file
     * Primary module hooks for Paragraph locator module.
     */

    Drupal does not have primary and secondary hooks. Instead of that, it is preferable to use the usual description: Hook implementations for the [module name] module. where [module name] is the name of the module given in its .info.yml file.

    4. FILE: src/ParagraphLocatorHelper.php

      /**
       * Constructor function.
       *
       * @param Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
       *   The entity type manager.
       */
      public function __construct(EntityTypeManagerInterface $entityTypeManager) {

    FILE: src/Controller/ParagraphLocator.php

      /**
       * Constructs a new messenger object.
       *
       * @param \Drupal\Core\Messenger\MessengerInterface $messenger
       *   The messenger service.
       */
      public function __construct(MessengerInterface $messenger) {

    The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.

  • Status changed to Needs review 5 months ago
  • 🇮🇳India deepak5423

    Thanks for the reviews.

    I have added the changes accordingly.
    Please review.

  • 🇮🇳India vishal.kadam Mumbai

    Rest looks fine to me.

    Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

  • Status changed to RTBC 5 months ago
  • 🇮🇳India vishal.kadam Mumbai
  • Status changed to Needs review 5 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    As a side note, since this project has been created today, it will be necessary to wait ten days before opting into security advisory coverage.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇷🇴Romania bbu23

    Hi,

    Just took a quick look and here are some thoughts:

    1. The module provides a view config in the config/install folder, but does not have a dependency to drupal:views in the info file

    2. The module's help hook partially uses translations: paragraph_locator_help(). All text should be translatable.

    3. In the hook help, there are hardcoded links. E.g. <a href="/paragraph-locator">Link</a>. One should use the Drupal\Core\Url class to generate the urls, and inject them in the translatable strings.

    4. Not sure why the parent entity function skips any entity that is not a node in the ParagraphLocatorHelper service, method getParentEntity. A paragraph can be attached to any type of entity.

    5. In the view, you have the following:
    text: "{% if parent_type == \"node\" %}\r\n <a href=\"{{ parent_type }}/{{ parent_id }}/edit\">Entity URL</a>\r\n{% elseif parent_type == \"block_content\" %}\r\n <a href=\"block/{{ parent_id }}\">Entity URL</a>\r\n{% endif %}"
    This is very specific and won't work with any entity, and the paths are no dynamic. Since you have the parent type and parent ID, why not using the the twig url function to dynamically build the paths or to build a custom field type that covers any entity type?

  • Status changed to Needs work 5 months ago
  • 🇮🇳India vishal.kadam Mumbai
  • Status changed to Needs review 5 months ago
  • 🇮🇳India deepak5423

    Hi,
    I have noticed the changes mentioned earlier and have fixed them.

    Regarding comment #14, point 6: Since we wanted to have a popup on the same screen without any redirection to another route for confirm form, we decided to stick with the JavaScript popup. As for the bulk operation link to delete the paragraph types, it seems like a functionality we might consider implementing in a future release of the module if needed.

    Moving to Needs Review.
    Please review.

    Thanks.

  • Status changed to Needs work 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    src/Controller/ParagraphLocator.php

      /**
       * The messenger object.
       *
       * @var \Drupal\Core\Messenger\MessengerInterface
       */
      protected $messenger;
    

    That property is already defined by the parent class. A class extending ControllerBase needs to call setMessenger() in the constructor (or create()).

  • Status changed to Needs review 4 months ago
  • 🇮🇳India deepak5423

    Thanks for the review @avpaderno,

    I have updated the module accordingly.
    Please review.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
      public static function create(ContainerInterface $container) {
        return new static(
          $container->get('messenger')
        );
      }
    

    ControllerBase does not have a constructor.
    setMessenger() (the method) must be called either from create() (the static method) or from the class constructor. Doing it from create() is shorter, as create() does not need to pass an argument to the class constructor which then calls setMessenger().

  • 🇮🇳India deepak5423

    Thanks for the review @avpaderno,

    I have updated the module accordingly.
    Please review.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank 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 the dedicated reviewers as well.

  • Status changed to Fixed 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Assigned to apaderno
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024