ZEN widgets is a platform that provides nocode web enhancements that can be implemented in any website.
For Drupal, I have create a module that makes it even easier to place widgets by adding a settings page and a custom field type that can be used to select and render widgets.

Project link

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

Comments

markwittens created an issue. See original summary.

vishal.kadam’s picture

Issue summary: View changes
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.

  • New releases are not necessary for these applications, which could require changes that are not backward-compatible. Not creating new releases avoids any possible issue.
  • Please do not change the branch to review once reviews started, except in the case the used branch needs to be deleted.
  • 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.

vishal.kadam’s picture

Status: Needs review » Needs work

1. FILE: zenwidgets.info.yml

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

FILE: composer.json

"drupal/core": "^9.5 || ^10 || ^11"

A new project should not declare itself compatible with a Drupal release that is no longer supported. No site should be using Drupal 8 nor Drupal 9, and people should not be encouraged to use those Drupal releases.

2. Fix the warnings/errors reported by PHP_CodeSniffer.

Note: I would suggest enabling GitLab CI for the project, follow the Drupal Association .gitlab-ci.yml template and fix the PHP_CodeSniffer errors/warnings it reports.

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml zenwidgets/

FILE: zenwidgets/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 15 | WARNING | Line exceeds 80 characters; contains 125 characters
----------------------------------------------------------------------

FILE: zenwidgets/src/Plugin/Field/FieldFormatter/WidgetDefaultFormatter.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
 10 | ERROR   | [x] Missing class doc comment
 37 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: zenwidgets/src/Plugin/Field/FieldWidget/WidgetDefaultWidget.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
 11 | ERROR   | [x] Missing class doc comment
 32 | ERROR   | [ ] Missing short description in doc comment
 33 | ERROR   | [ ] Description for the @return value is missing
 39 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: zenwidgets/src/Plugin/Field/FieldType/WidgetItem.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 11 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: zenwidgets/src/Form/ZenWidgetsConfigForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 11 | ERROR | [x] Missing class doc comment
 13 | ERROR | [ ] Missing member variable doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: zenwidgets/src/Service/ZenWidgetsService.php
--------------------------------------------------------------------------------
FOUND 28 ERRORS AND 2 WARNINGS AFFECTING 28 LINES
--------------------------------------------------------------------------------
  11 | ERROR   | [x] Missing class doc comment
  15 | ERROR   | [ ] Missing short description in doc comment
  16 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  20 | ERROR   | [ ] Missing short description in doc comment
  21 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  25 | ERROR   | [ ] Missing short description in doc comment
  26 | ERROR   | [ ] Missing parameter comment
  26 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  27 | ERROR   | [ ] Missing parameter comment
  27 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  37 | ERROR   | [ ] Missing short description in doc comment
  38 | ERROR   | [ ] Description for the @return value is missing
  46 | ERROR   | [ ] Missing short description in doc comment
  47 | ERROR   | [ ] Description for the @return value is missing
  53 | ERROR   | [ ] Missing short description in doc comment
  54 | ERROR   | [ ] Description for the @return value is missing
  60 | ERROR   | [ ] Missing short description in doc comment
  61 | ERROR   | [ ] Description for the @return value is missing
  67 | ERROR   | [ ] Missing short description in doc comment
  68 | ERROR   | [ ] Description for the @return value is missing
  74 | ERROR   | [ ] Missing short description in doc comment
  75 | ERROR   | [ ] Description for the @return value is missing
 100 | ERROR   | [ ] Missing short description in doc comment
 101 | ERROR   | [ ] Missing parameter comment
 102 | ERROR   | [ ] Missing parameter comment
 104 | ERROR   | [ ] Description for the @return value is missing
 117 | ERROR   | [ ] Missing short description in doc comment
 118 | ERROR   | [ ] Description for the @return value is missing
 124 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 130 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: zenwidgets/zenwidgets.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------    
markwittens’s picture

Status: Needs work » Needs review

Thanks for the quick response, all issues have been fixed.

vishal.kadam’s picture

Status: Needs review » Needs work

1. FILE: zenwidgets.info.yml

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

A new project should not declare itself compatible with a Drupal release that is no longer supported. No site should be using Drupal 8 nor Drupal 9, and people should not be encouraged to use those Drupal releases.

2. FILE: zenwidgets.module

/**
 * @file
 * Add the script to the page bottom.
 */

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.

3. FILE: src/Form/ZenWidgetsConfigForm.php

With Drupal 10 and Drupal 11, there is no longer need to use #default_value for each form element, when the parent class is ConfigFormBase: It is sufficient to use #config_target, as in the following code.

    $form['image_toolkit'] = [
      '#type' => 'radios',
      '#title' => $this->t('Select an image processing toolkit'),
      '#config_target' => 'system.image:toolkit',
      '#options' => [],
    ];

Using that code, it is no longer needed to save the configuration values in the form submission handler: The parent class will take care of that.

4. FILE: src/Form/ZenWidgetsConfigForm.php

  /**
   * The global configuration object.
   *
   * @var Drupal\Core\Config\Config
   */
  protected Config $config;

  /**
   * Constructor.
   *
   * @param Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   * @param Drupal\Core\Config\TypedConfigManagerInterface $typedConfigManager
   *   The config manager.
   */
  public function __construct(
    ConfigFactoryInterface $config_factory,
    protected TypedConfigManagerInterface $typedConfigManager,
  ) {
    parent::__construct($config_factory, $this->typedConfigManager);
    $this->config = $this->config('zenwidgets.config');
  }

FILE: src/Plugin/Field/FieldFormatter/WidgetDefaultFormatter.php

  /**
   * ZEN widgets service.
   *
   * @var \Drupal\zenwidgets\Service\ZenWidgetsService
   *   The ZEN widgets service.
   */
  protected ZenWidgetsService $widgetsService;

  /**
   * Constructs a WidgetDefaultFormatter instance.
   *
   * @param string $plugin_id
   *   The plugin ID for the formatter.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
   *   The definition of the field to which the formatter is associated.
   * @param array $settings
   *   The formatter settings.
   * @param string $label
   *   The formatter label display setting.
   * @param string $view_mode
   *   The view mode.
   * @param array $third_party_settings
   *   Any third party settings.
   * @param \Drupal\zenwidgets\Service\ZenWidgetsService $widgets_service
   *   The ZEN widgets service.
   */
  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, ZenWidgetsService $widgets_service) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
    $this->widgetsService = $widgets_service;
  }

FILE: src/Plugin/Field/FieldWidget/WidgetDefaultWidget.php

  /**
   * ZEN widgets service.
   *
   * @var \Drupal\zenwidgets\Service\ZenWidgetsService
   *   The ZEN widgets service.
   */
  protected ZenWidgetsService $widgetsService;

  /**
   * Constructs a WidgetBase object.
   *
   * @param string $plugin_id
   *   The plugin ID for the widget.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
   *   The definition of the field to which the widget is associated.
   * @param array $settings
   *   The widget settings.
   * @param array $third_party_settings
   *   Any third party settings.
   * @param \Drupal\zenwidgets\Service\ZenWidgetsService $widgets_service
   *   The ZEN widgets service.
   */
  public function __construct(
    $plugin_id,
    $plugin_definition,
    FieldDefinitionInterface $field_definition,
    array $settings,
    array $third_party_settings,
    ZenWidgetsService $widgets_service,
  ) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
    $this->widgetsService = $widgets_service;
  }

FILE: src/Service/ZenWidgetsService.php

  /**
   * Http client interface.
   *
   * @var \GuzzleHttp\ClientInterface
   *   The client to retrieve the widgets.
   */
  protected ClientInterface $httpClient;

  /**
   * Language manager.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface
   *   The language manager.
   */
  protected LanguageManagerInterface $languageManager;

  /**
   * Configuration object.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected ImmutableConfig $config;

  /**
   * Logger object.
   *
   * @var \Psr\Log\LoggerInterface
   */
  protected LoggerInterface $logger;

  /**
   * Constructor.
   *
   * @param GuzzleHttp\ClientInterface $http_client
   *   The HTTP client.
   * @param Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   * @param \Psr\Log\LoggerInterface $logger
   *   The logger interface.
   */
  public function __construct(
    ClientInterface $http_client,
    LanguageManagerInterface $language_manager,
    ConfigFactoryInterface $config_factory,
    LoggerInterface $logger,
  ) {
    $this->httpClient = $http_client;
    $this->languageManager = $language_manager;
    $this->config = $config_factory->get('zenwidgets.config');
    $this->logger = $logger;
  }

New modules, which are compatible with Drupal 10 and higher versions are expected to include type declarations in property definitions, and use constructor property promotion.

markwittens’s picture

Status: Needs work » Needs review

Thanks again for the feedback. I have updated the code accordingly.

vishal.kadam’s picture

Status: Needs review » Reviewed & tested by the community

Rest seems fine to me.

Please wait for a Project Moderator to take a look and if everything goes fine, you will get the role.

avpaderno’s picture

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 also all the reviewers for helping with these applications.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Reviewed & tested by the community » Fixed

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.

Status: Fixed » Closed (fixed)

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