The module provides a dynamic filtering for entity reference fields based on parent field values, with AJAX support. It is lightweight and focused, ideal for projects that need dynamic reference filtering without the complexity of full rules engines.
The project adheres to Drupal's coding standards, avoids known insecure practices, and is maintained transparently via the Drupal.org infrastructure.

Project link

https://www.drupal.org/project/dynamic_reference_selection

Comments

iheb.attia created an issue. See original summary.

avpaderno’s picture

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, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
  • For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
  • 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.
  • Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
  • 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. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
  • 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.

avpaderno’s picture

Status: Needs review » Needs work

I do not have time for a complete review, but the following code needs to be changed.

  /**
   * DynamicReferenceSelectionUtil constructor.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
   *   The container service.
   */
  public function __construct(ContainerInterface $container) {

    $this->container              = $container;
    $this->entityFieldManager     = $container->get('entity_field.manager');
    $this->fieldTypePluginManager = $container->get('plugin.manager.field.field_type');
    $this->request                = $container->get('request_stack')
      ->getCurrentRequest();
  }

Services define their dependencies in the .services.yml file, and those are directly passed to the class constructor.

vishal.kadam’s picture

1. FILE: src/Ajax/UpdateOptionsCommand.php

  /**
   * UpdateOptionsCommand constructor.
   *
   * @param string $elementId
   *   The element html id.
   * @param array $options
   *   The element options [key, value].
   * @param string $formatter
   *   The field formatter.
   * @param bool $multiple
   *   The 'multiple' attribute of select.
   */
  public function __construct(

FILE: src/Util/DynamicReferenceSelectionUtil.php

  /**
   * DynamicReferenceSelectionUtil constructor.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
   *   The container service.
   */
  public function __construct(ContainerInterface $container) {

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.

2. FILE: dynamic_reference_selection.module

/**
 * @file
 * Dynamic Reference Selection module.
 */

The usual description for a .module file is “Hook implementations for the [module name] module”, where [module name] is the module name given in the .info.yml file.

iheb.attia’s picture

Thank you avpaderno and vishal.kadam for reviewing the module. I've addressed the previous issues in this commit.
Please let me know if there's anything else that needs to be fixed, or if you can proceed with approving my request for Security Advisory coverage.

iheb.attia’s picture

Status: Needs work » Needs review
iheb.attia’s picture

avpaderno’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3528264: [1.0.x] Node Alias Link Display

It appears there are multiple project applications created using your account.

Since a successful completion of the project application process results in the applicant being granted the necessary role to be able to opt projects into security advisory coverage, there is no need to take multiple applications through the process. Once the first application has been successfully approved, the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers, which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as Closed (duplicate), with only one application left open.

If you prefer that we proceed through this review process with a different application, then feel free to close the application left open as a duplicate, and re-open one of the project applications which had been closed.

avpaderno’s picture

avpaderno’s picture

Status: Closed (duplicate) » Needs review

Let's continue with this application, since it uses a project with enough Drupal code.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Issue summary: View changes
avpaderno’s picture

Status: Needs review » Needs work
  • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
  • A specific point may just be an example and may apply in other places
  • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
  • The single review points are not ordered, not even by importance

src/Plugin/EntityReferenceSelection/DynamicReferenceSelectionViewsSelection.php

  /**
   * Constructs a new SelectionBase object.
   *

That short description is for a different class.

Why does not DynamicReferenceSelectionViewsSelection.php extend SelectionBase?

src/Util/DynamicReferenceSelectionUtil.php

      if (($field_storage instanceof FieldConfig || ($field_storage instanceof BaseFieldDefinition && $field_name == 'title'))
      ) {

The curly parenthesis needs to be on the same line containing if, as per Drupal coding standards.

avpaderno’s picture

Assigned: avpaderno » Unassigned
iheb.attia’s picture

Hello avpaderno,
Thank you very much for your detailed review and the time you spent on it.
The requested changes have been addressed in this commit.
Could you please take another look so that the module can move forward and become eligible for Drupal security advisory coverage?

iheb.attia’s picture

Status: Needs work » Needs review
bbu23’s picture

Assigned: Unassigned » bbu23
bbu23’s picture

Assigned: bbu23 » Unassigned
Status: Needs review » Needs work

Hi, here're some quick thoughts from my end:

Optional observations:

- There is no dev release for this project. While not mandatory to have one, I’d recommend it.
- The __construct() method’s description is not mandatory anymore, it can either be removed or be kept as is if preferred.

Feedback:

- For a new module that aims to be compatible with Drupal 10 and Drupal 11, I would rather implement:
--- hooks as class methods as described in Support for object oriented hook implementations using autowired services.
--- plugins as PHP Attributes instead of PHP Annotations as described in Attribute-based plugins
- There seem to be some properties defined in the Annotation class that might not be used. Is it on purpose or am I mistaken?
- In the dynamic_reference_selection.module file, it’s probably not a good idea to use stdClass. Furthermore, it’s not even used, so the line becomes redundant.
- Same file, line 23: the variable comment should be in one line
- Same file, $items = $context['items']; is initialised twice, once when even not checking if context is set. This piece of code could be improved.
- Line 44, $parent_field = NULLl; not used
- src/Plugin/EntityReferenceSelection/DynamicReferenceSelectionViewsSelection.php: The messenger service is passed as argument in create method, but never received in the constructor. Is it used?
- Same file, as described in the web/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php file, it is better to use the Trait’s t() function when possible. I see no reason for using the TranslatableMarkup here, u should change to t().

The above observations serve as examples, I didn't have time to go through everything.
On the other hand, the coding standards and best practices successfully validated with PHPCS.

vishal.kadam’s picture

Priority: Normal » Minor

I am changing priority as per Issue priorities.

avpaderno’s picture

This thread has been idle, in the needs work state with no activity for some months.

May you confirm you are still pursuing this application? If this is the case, and you made commits basing on what previously reported, or you can answer the questions previously asked, please change the status to Needs review.

avpaderno’s picture

Status: Needs work » Closed (won't fix)

This thread has been idle, in the Needs work state with no activity for about six months or more; the application has been created about 11 months ago or more. Therefore, I marked it as Closed (won't fix).

If this is incorrect, and you are still pursuing this application, please feel free to re-open it and set the issue status to Needs work or Needs review, depending on the current status of your code.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.