Review and follow Coding Standards

Created on 23 November 2017, over 6 years ago
Updated 18 August 2023, 11 months ago

Problem/Motivation

Webform Analysis should follow Drupal's Coding Standards because it will make it easier for people understand the code and contribute patches.

Proposed resolution

Review and follow Coding Standards

Here is the automated code review.

https://pareview.sh/node/3040

Some suggestions...

  • When in doubt look at core.
  • Add API comments to everything
  • Add \Drupal\webform_analysis\WebformAnalysisInterface and code to Interfaces β†’
  • Use Dependency injection when possible.
  • Always use the webform_analysis namespace, you should change 'webform-admin.css' to 'webform_analysis.admin.css'
  • Instead of using \Drupal\webform_analysis\Form\WebformAnalysisForm::getWebformIdFromRoute use \Drupal\webform\WebformRequest to get the current pages webform entity.
  • Remove \Drupal\webform_analysis\WebformAnalysis::MODULE_NAME and just use the module name.
  • \Drupal\webform_analysis\WebformAnalysis::__construct should be used for dependency injection

You might need to 'cast' the webform to an entity in your routes...

entity.webform.results_analysis:
  path: '/admin/structure/webform/manage/{webform}/results/analysis'
  defaults:
    _form: '\Drupal\webform_analysis\Form\WebformAnalysisForm'
    _title_callback: '\Drupal\webform_analysis\Form\WebformAnalysisForm::getTitle'
  options:
    parameters:
      webform:
        type: 'entity:webform'
  requirements:
    _permission: 'view any webform submission'
πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024