[8.x-1.x] Mailjet Webform Subscription

Created on 17 October 2024, about 1 month ago

The Mailjet Webform Subscription module is specifically designed to assist administrators in integrating with Mailjet for the purpose of subscribing contacts to a mailing list from any webform. The idea is doing this while using a lightweight design and being user-friendly, offering administrators a singular form element with configuration that shows as a checkbox to users.

During the configuration of this element, administrators can select the relevant webform fields (such as email*, first name, and last name) via drop-down menus, in addition to choosing the appropriate Mailjet templates for the emails and determining the Mailjet list to which the contact will be subscribed.

The primary updates included in this branch add compatibility with more recent versions of Drupal. Furthermore, acknowledging that it has become a legal requirement in many instances to send a confirmation email prior to subscribing an individual to a newsletter, this functionality has been integrated into the module. An optional confirmation email feature is also available, with both options utilizing Mailjet templates.

This branch is essentially a complete re-write of the module whilst following its primary objective. Bear in mind the module is on the small side and has been upgraded from D7.

Project Page: mailjet_webform_subscription

Clone Repo : git clone -b 8.x-1.x --single-branch https://git.drupalcode.org/project/mailjet_webform_subscription.git

Install: composer require 'drupal/mailjet_webform_subscription:^1.0'

📌 Task
Status

Needs review

Component

module

Created by

🇪🇸Spain kieranpowell

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

Comments & Activities

  • Issue created by @kieranpowell
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    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 will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.
      Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
    • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
    • 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 project moderator before posting the first comment on newly created applications. Project moderators 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 .

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇳India vishal.kadam Mumbai

    1. mailjet is a wrong name for a branch. Release branch names always end with the literal .x as described in Release branches .

    2. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml mailjet_webform_subscription/
    
    FILE: mailjet_webform_subscription/README.md
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
    ----------------------------------------------------------------------------
      3 | WARNING | Line exceeds 80 characters; contains 92 characters
      4 | WARNING | Line exceeds 80 characters; contains 94 characters
      5 | WARNING | Line exceeds 80 characters; contains 124 characters
      7 | WARNING | Line exceeds 80 characters; contains 107 characters
     20 | WARNING | Line exceeds 80 characters; contains 129 characters
     21 | WARNING | Line exceeds 80 characters; contains 128 characters
     26 | WARNING | Line exceeds 80 characters; contains 236 characters
     30 | WARNING | Line exceeds 80 characters; contains 112 characters
     31 | WARNING | Line exceeds 80 characters; contains 110 characters
     32 | WARNING | Line exceeds 80 characters; contains 109 characters
     34 | WARNING | Line exceeds 80 characters; contains 196 characters
     35 | WARNING | Line exceeds 80 characters; contains 226 characters
     38 | WARNING | Line exceeds 80 characters; contains 151 characters
     39 | WARNING | Line exceeds 80 characters; contains 85 characters
    ----------------------------------------------------------------------------
    
    FILE: mailjet_webform_subscription/src/MailjetApiWrapper.php
    -------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    -------------------------------------------------------------------------------
     50 | ERROR | [x] Missing function doc comment
     85 | ERROR | [ ] The array declaration extends to column 119 (the limit is 80). The array content should be split up over multiple lines
     90 | ERROR | [ ] The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
    -------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------
    
    FILE: mailjet_webform_subscription/src/Plugin/WebformElement/WebformMailListCheckbox.php
    -------------------------------------------------------------------------------
    FOUND 7 ERRORS AFFECTING 7 LINES
    -------------------------------------------------------------------------------
     218 | ERROR | The array declaration extends to column 102 (the limit is 80). The array content should be split up over multiple lines
     219 | ERROR | The array declaration extends to column 108 (the limit is 80). The array content should be split up over multiple lines
     220 | ERROR | The array declaration extends to column 116 (the limit is 80). The array content should be split up over multiple lines
     221 | ERROR | The array declaration extends to column 102 (the limit is 80). The array content should be split up over multiple lines
     224 | ERROR | The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
     225 | ERROR | The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
     226 | ERROR | The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
    -------------------------------------------------------------------------------
    
    FILE: mailjet_webform_subscription/mailjet_webform_subscription.module
    -------------------------------------------------------------------------------
    FOUND 10 ERRORS AFFECTING 10 LINES
    -------------------------------------------------------------------------------
     26 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     27 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     28 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     29 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     30 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     31 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 10
     32 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     33 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
     34 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 10
     35 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
    -------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------
    
    FILE: mailjet_webform_subscription/mailjet_webform_subscription.libraries.yml
    -------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------
     10 | ERROR | [x] Expected 1 newline at end of file; 2 found
    -------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------

    3. FILE: mailjet_webform_subscription.info.yml

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

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

    4. FILE: mailjet_webform_subscription.module

    /**
     * @file
     * Contains hook implementations.
     */

    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.

    5. FILE: src/Controller/ConfirmSubscriptionController.php

      /**
       * Controller constructor.
       *
       * @param \Drupal\Core\Database\Connection $database
       *   The database connection.
       * @param \Drupal\Core\PageCache\ResponsePolicy\KillSwitch $killSwitch
       *   The mail manager service.
       * @param \Drupal\webform\WebformThemeManagerInterface $themeManager
       *   The theme manager service.
       * @param \Drupal\Core\Session\AccountProxyInterface $user
       *   The current user.
       * @param \Psr\Log\LoggerInterface $logger
       *   The logger service.
       * @param \Drupal\mailjet_webform_subscription\IMailjetApiWrapperInterface $mailjetApiWrapper
       *   The mailjet api wrapper.
       */
      public function __construct($database, $killSwitch, $themeManager, $user, $logger, $mailjetApiWrapper) {

    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.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    For these applications, we need a project where, in at least a branch, most of the commits (but preferably all the commits) have been done from the person who created the application.
    The purpose of these applications is reviewing a project to understand what the person who applies understands about writing secure code which follows the Drupal coding standards and correctly uses the Drupal API, not what all the project maintainers collectively understand about those points.

  • 🇪🇸Spain kieranpowell

    Thank you very much for your time and suggestions!

    I apologize for the phpcs issues, I will know for future commits to use the --extension parameter :).

    I have addressed all concerns in the latest commit on the 8.x-1.x branch.

  • 🇮🇳India vishal.kadam Mumbai

    Rest seems fine to me.

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

  • 🇪🇸Spain kieranpowell

    Thank you @vishal.kadam

Production build 0.71.5 2024