[1.0.x] Brevo Contact Sync

Created on 26 December 2024, 3 months ago

This module allows you to map user field values with Brevo according to your requirements. It also dynamically provides Brevo contact lists in the Drupal mapping form. An additional feature is the Key/Value functionality. When the user selects an option key, the corresponding value is mapped accordingly.

Project Link

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

📌 Task
Status

Needs review

Component

module

Created by

🇮🇳India daljeet-kaur

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

Comments & Activities

  • Issue created by @daljeet-kaur
  • 🇮🇹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 enable GitLab CI for the project and fix the PHP_CodeSniffer errors/warnings it reports.
    • 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 → .

  • 🇮🇳India vishal.kadam Mumbai

    1. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml brevo_contact_sync/
    
    FILE: brevo_contact_sync/brevo_contact_sync.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
     15 | ERROR   | Doc comment is empty
     22 | WARNING | Unused variable $uid.
     24 | WARNING | Unused variable $name.
     53 | WARNING | Unused variable $name.
    --------------------------------------------------------------------------------
    
    FILE: brevo_contact_sync/src/Form/BrevoContactMappingForm.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
     100 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     108 | WARNING | Unused variable $id.
     122 | WARNING | Unused variable $key.
     134 | ERROR   | The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
     134 | ERROR   | The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    FILE: brevo_contact_sync/brevo_contact_sync.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    --------------------------------------------------------------------------------

    2. FILE: brevo_contact_sync.module

    /**
     * @file
     * Code for the brevo_contact_sync 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.

                else {
                  $value = 'testst';
                }

    Consider adding a comment to clarify the purpose of 'testst' or using more descriptive placeholder text.

  • 🇮🇳India daljeet-kaur

    Hello Vishal

    I have fixed the above-mentioned phpcs issues.
    Please check
    Thank you in advance

  • 🇮🇳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.

  • 🇮🇳India rushiraval

    I am changing priority as per Issue priorities. →

  • 🇪🇸Spain alexismmd

    1. FILE = src/Form/BrevoContactMappingForm.php

    public function fieldContent() {
        $options = [];
        $listUsersFields = $this->entityFieldManager->getFieldDefinitions('user', 'user');
        foreach ($listUsersFields as $field) {
          $fieldName = $field->getName();
          if (isset($fieldName)) {
            $selected_value = $fieldName;
            $entityManager = \Drupal::service('entity_field.manager');
            $definitions = $entityManager->getFieldDefinitions('user', 'user');
    

    Use $this->entityFieldManager property instead of \Drupal::service

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Furthermore, $listUsersFields already contains the list of the fields for the User entity.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇳India daljeet-kaur

    Hello @avpaderno

    I have fixed the above-mentioned code changes as per requirement.
    Could you please review the dev version of module?

    Thank you

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024