- Status changed to Needs work
almost 2 years ago 10:18am 4 March 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
- * @param null $key + * @param string $key + * The default keys in galleryslider settings. * * @return array|mixed + * An array with all settings key.
Since the parameter is
$key
and it is a string, probably the default keys (plural) is not correct. It is not even the default key.
The function does not always return an array. That needs to be made clear.* @return mixed + * Formatted js array. */ -function _galleryslider_format_settings($settings) { +function _galleryslider_format_settings(array $settings) {
If it is
mixed
, it is not an array.- var rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g; + var rvalidescape = /\\(?:["\\\/bfnrt] | u[\da - fA - F]{4}) / g;
Spaces inside a regular expression are wrong, except in the case they are part of the regular expression, which does not seem in this case.
+ * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object
Lines are indented by two spaces.
- * once: will ensure the callback list can only be fired once (like a Deferred) + * once: will ensure the callback list can only be fired once (like a Deferred)
The line was already correctly indented (two spaces).
- First commit to issue fork.
- Status changed to Needs review
almost 2 years ago 11:33am 12 May 2023 - thakurnishant_06 India
Hello Folks !!
Created a patch for galleryslider 8.x-3.x-dev . The patch seems to fix the phpcs issues.
Can someone please review the patch.Thank you for your support!!!
- last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago Build Successful - last update
over 1 year ago Build Successful - Status changed to RTBC
over 1 year ago 11:00am 20 June 2023 - 🇮🇳India Anmol_Specbee
The patch#20 mentioned in the comment#21 is working and is resolving all the issues.
- Status changed to Needs work
over 1 year ago 11:18am 21 June 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
-/** - * @file - * Contains galleryslider.module.. - */
A module file needs to contain that comment, but the description given there is Hook implementations for the Gallery Slider for Multiple Images module. (assuming that the module name shown in the .info.yml file is Gallery Slider for Multiple Images).
diff --git a/galleryslider.module b/galleryslider.module index b3ea4ce..52553c2 100644 --- a/galleryslider.module +++ b/galleryslider.module @@ -1,159 +1,89 @@ <?php -/** - * @file - * Contains galleryslider.module.. - */ +namespace Drupal\galleryslider\Plugin\views\style; -use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Form\FormStateInterface; +use Drupal\views\Plugin\views\style\StylePluginBase; /** - * Implements hook_help(). + * Style plugin to render each item into a simple carousel. * - * @param $route_name - * @param \Drupal\Core\Routing\RouteMatchInterface $route_match + * @ingroup views_style_plugins * - * @return string + * @ViewsStyle( + * id = "galleryslider", + * title = @Translation("Gallery Slider"), + * help = @Translation("Displays rows as a gallery slider."), + * theme = "galleryslider_views", + * display_types = {"normal"} + * ) */ -function galleryslider_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - // Main module help for the simple module. - case 'help.page.galleryslider': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('simple Carousel: Download code at drupal.org') . '</p>'; - $output .= '<p>' . t('Video tutorial will be uploaded soon') . '</p>'; - return $output; - - default: - } -} +class GallerySlider extends StylePluginBase { -/** - * Implements hook_theme(). - */ -function galleryslider_theme() { - return [ - 'galleryslider' => [ - 'variables' => ['items' => NULL, 'settings' => NULL], - ], - 'galleryslider_views' => [ - 'variables' => [], - ], - ]; -} - -/** - * Themeable for galleryslider. - * - * @param $variables - */ -function template_preprocess_galleryslider(&$variables) { - $items = $variables['items']; - $settings = _galleryslider_format_settings($variables['settings']); - $variables['attributes']['class'][] = 'slider'; - $variables['attributes']['class'][] = ''; - $variables['attributes']['data-settings'] = json_encode($settings); - $html = ''; - if (!empty($items)) { - $i = 0; - $html .= '<ul data-title="Row">'; - foreach ($items as $item) { - $html .= '<li ' . $i . '>' . render($item) . '</li>'; - $i++; - } - } + /** + * Indicates whether the style plugin allows the use of row plugins. + * + * @var bool + */ + protected $usesRowPlugin = TRUE; - $html .= '</ul>'; - $output = [ - '#type' => 'markup', - '#markup' => $html, - ]; - $variables['output'] = render($output); -} + /** + * Indicates whether the style plugin supports custom CSS class for the rows. + * + * @var bool + */ + protected $usesRowClass = TRUE; -/** - * Prepares variables for Views galleryslider carousel templates. - * - * Default template: galleryslider-views.html.twig. - * - * @param array $variables - * An associative array containing: - * - view: A View object. - */ -function template_preprocess_galleryslider_views(array &$variables) { - $handler = $variables['view']->style_plugin; - $settings = _galleryslider_format_settings($handler->options); - $variables['attributes']['class'][] = 'slider '; - $variables['attributes']['class'][] = ''; - $variables['attributes']['data-settings'] = json_encode($settings); - template_preprocess_views_view_unformatted($variables); -} + /** + * Defines the default options for the style plugin. + */ + protected function defineOptions() { + $options = parent::defineOptions(); -/** - * Settings to display view at front page. - * - * @param $variables - */ -function galleryslider_preprocess_page(&$variables) { - $node = \Drupal::routeMatch()->getParameter('node'); - $frontpage = \Drupal::service('path.matcher')->isFrontPage(); - if ($node || $frontpage) { - $variables['#attached']['library'][] = 'galleryslider/galleryslider'; + $settings = _galleryslider_default_settings(); + foreach ($settings as $k => $v) { + $options[$k] = ['default' => $v]; + } + return $options; } -} -/** - * Default settings for simple. - * - * @param null $key - * - * @return array|mixed - */ -function _galleryslider_default_settings($key = NULL) { - $settings = [ - 'menu' => 'grid', - 'imgGrid' => '', - 'speed' => 300, - 'image_style' => '', - 'image_link' => '', - ]; - - return isset($settings[$key]) ? $settings[$key] : $settings; -}
Removing the hook implementations from that file to add a class (which should not be placed in a .module file) is blatantly wrong.
- Status changed to Needs review
over 1 year ago 1:14pm 21 June 2023 - Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - thakurnishant_06 India
hello @apaderno, hope you are doing well.
updated the patch addressed #24 issues.
kindly review the updated patch.
Thank you for your support. - Status changed to Needs work
over 1 year ago 2:36pm 21 June 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
diff --git a/galleryslider.module b/galleryslider.module index 52553c2..ff875fd 100644 --- a/galleryslider.module +++ b/galleryslider.module @@ -1,89 +1,166 @@ <?php -namespace Drupal\galleryslider\Plugin\views\style; +/** + * @file + * Contains the Gallery Slider for Multiple Images module. + */
I take the patch is created from the wrong files, since the first lines from the galleryslider.module are the following one.
<?php /** * @file * Contains galleryslider.module.. */ use Drupal\Core\Routing\RouteMatchInterface; /** * Implements hook_help(). * * @param $route_name * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * * @return string */
- 🇮🇳India AkashKumar07
This patch addresses the #11 changes. Please review.
Thanks! - Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - Status changed to Needs review
over 1 year ago 4:01am 22 June 2023 The last submitted patch, 27: 3161596-27.patch, failed testing. View results →
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- 🇮🇳India zkhan.aamir
Hi,
Patch #27 applied successfully.
Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/galleryslider (8.x-3.x) $ curl https://www.drupal.org/files/issues/2023-06-22/3161596-27.patch | patch -p1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17884 100 17884 0 0 33384 0 --:--:-- --:--:-- --:--:-- 33490 patching file css/galleryslider.css patching file galleryslider.module patching file js/galleryslider.js patching file js/gridSlide.js patching file js/slider.js patching file src/Plugin/Field/FieldFormatter/GallerySliderFieldFormatter.php patching file src/Plugin/views/style/GallerySlider.php
All the issue resolved.
Hi, patch #27 applied cleanly but it not fixes all the phpcs issues.
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml galleryslider/ FILE: C:\Users\Nisha\galleryslider\css\galleryslider.css ---------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------------------- 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" ---------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------------------- FILE: C:\Users\Nisha\galleryslider\css\gridslide.css ---------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------------------- 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" ---------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------------------- FILE: C:\Users\Nisha\galleryslider\galleryslider.install ---------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------------------- 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" ---------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------------------- FILE: C:\Users\Nisha\galleryslider\galleryslider.module ------------------------------------------------------------------------------------ FOUND 2 ERRORS AFFECTING 2 LINES ------------------------------------------------------------------------------------ 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" 121 | ERROR | [x] Use null coalesce operator instead of ternary operator. ------------------------------------------------------------------------------------ PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------ FILE: C:\Users\Nisha\galleryslider\src\Plugin\Field\FieldFormatter\GallerySliderFieldFormatter.php ----------------------------------------------------------------------------------------------------- FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES ----------------------------------------------------------------------------------------------------- 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" 172 | WARNING | [x] 'TODO: Implement settings summary.' should match the format '@todo Fix problem | | X here.' 242 | ERROR | [x] Use null coalesce operator instead of ternary operator. ----------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------- FILE: C:\Users\Nisha\galleryslider\src\Plugin\views\style\GallerySlider.php ---------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------------------- 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" ---------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------------------- Time: 474ms; Memory: 10MB
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - First commit to issue fork.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - First commit to issue fork.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
12 months ago Waiting for branch to pass - Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
12 months ago Waiting for branch to pass haris khan jadoon → changed the visibility of the branch 3161596-fix-the-issues to hidden.
- 🇵🇭Philippines roberttabigue
Hi,
I have applied the latest MR !4 to the Gallery Slider for Multiple Images module with 8.x-3.x-dev and confirmed all PHPCS errors have been fixed. Please see the attached file for reference.
However, when I reran the PHPCS in the GitLab CI pipeline, the jobs failed to pass.
Running with gitlab-runner 17.8.1 (a1fca00e) on gitlab-runner-5d87599478-mlgfr s8ex1X2yJ, system ID: r_5VJgs5AORaQn Resolving secrets Preparing the "kubernetes" executor 00:00 "CPURequest" overwritten with "2" Using Kubernetes namespace: gitlab-runner Using Kubernetes executor with image drupalci/php-8.1-apache:production ... Using attach strategy to execute scripts... Preparing environment 00:31 Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 1h0m0s... Waiting for pod gitlab-runner/runner-s8ex1x2yj-project-107719-concurrent-0-h2y792bb to be running, status is Pending Running on runner-s8ex1x2yj-project-107719-concurrent-0-h2y792bb via gitlab-runner-5d87599478-mlgfr... Getting source from Git repository 00:02 Fetching changes with git depth set to 50... Initialized empty Git repository in /builds/issue/galleryslider-3161596/.git/ Created fresh repository. Checking out 15fa264a as detached HEAD (ref is apaderno-8.x-3.x-patch-7f68)... Skipping Git submodules setup Downloading artifacts 00:09 Downloading artifacts for composer (1063176)... Downloading artifacts from coordinator... ok host=drupal-gitlab-job-artifacts.s3.us-west-2.amazonaws.com id=1063176 responseStatus=200 OK token=glcbt-64 Executing "step_script" stage of the job script 00:02 $ [[ $_CURL_TEMPLATES_REF == "" ]] && export _CURL_TEMPLATES_REF=$_GITLAB_TEMPLATES_REF # collapsed multi-line command $ test -f phpcs.xml.dist || curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/phpcs.xml.dist % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 47203 0 47203 0 0 331k 0 --:--:-- --:--:-- --:--:-- 331k $ vendor/bin/phpcs --version PHP_CodeSniffer version 3.9.0 (stable) by Squiz and PHPCSStandards $ composer show | awk '$0 ~ /codesniffer|coder|coding-standard|variable-analysis/ {print $1 " " $2}'; dealerdirect/phpcodesniffer-composer-installer 1.0.0 drupal/coder 8.3.23 sirbrillig/phpcs-variable-analysis 2.11.17 slevomat/coding-standard 8.15.0 squizlabs/php_codesniffer 3.9.0 $ vendor/bin/phpcs --config-show installed_paths Using config file: /builds/issue/galleryslider-3161596/vendor/squizlabs/php_codesniffer/CodeSniffer.conf installed_paths: ../../drupal/coder/coder_sniffer,../../sirbrillig/phpcs-variable-analysis,../../slevomat/coding-standard $ vendor/bin/phpcs -i The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, Drupal, DrupalPractice, VariableAnalysis and SlevomatCodingStandard $ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source ERROR: Ruleset /builds/issue/galleryslider-3161596/phpcs.xml.dist is not valid - On line 10, column 8: Opening and ending tag mismatch: meta line 4 and head - On line 73, column 9: Opening and ending tag mismatch: head line 4 and html - On line 74, column 1: EndTag: '</' not found Run "phpcs --help" for usage information Uploading artifacts for failed job 00:00 Uploading artifacts... WARNING: junit.xml: no matching files. Ensure that the artifact path is relative to the working directory (/builds/issue/galleryslider-3161596) ERROR: No files to upload Uploading artifacts... WARNING: junit.xml: no matching files. Ensure that the artifact path is relative to the working directory (/builds/issue/galleryslider-3161596) ERROR: No files to upload Cleaning up project directory and file based variables 00:01 ERROR: Job failed: command terminated with exit code 1
Please refer to this link: https://git.drupalcode.org/issue/galleryslider-3161596/-/jobs/4152058
I'm moving this to 'Needs work' for now.
Thank you.