- 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
over 1 year 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
11 months 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
11 months 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
9 months ago Waiting for branch to pass - Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
9 months ago Waiting for branch to pass