- Issue created by @sonam_sharma
- Issue was unassigned.
- Status changed to Needs work
over 1 year ago 10:02am 3 July 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
The issue summary should always describe what the issue is trying to fix and, in the case of coding standards issues, show which command and arguments have been used and which report that command shown. In this way, project maintainers can verify the patch/MR fixes all the warnings/errors.
- Status changed to Needs review
over 1 year ago 7:11am 6 July 2023 - Status changed to RTBC
over 1 year ago 6:56am 13 July 2023 - 🇵🇭Philippines paraderojether
Hi
I reviewed patch #2, applied against Ekam - Blogging, News Drupal theme 8.0.x-dev, and confirmed it fixes the issues reported by phpcs.
I added screenshots for reference.
Thank you. - Status changed to Needs work
over 1 year ago 8:38am 13 July 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
--- a/ekam.theme +++ b/ekam.theme @@ -1,13 +1,16 @@ <?php -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Template\Attribute; +/** + * @file + * Functions to support theming in the pachu theme. + */
The theme name reported in the ekam.info.yml file is Ekam - Bloging, news Drupal theme. Since that seems more a description, I would use Ekam as theme name.
The used description is for the pachu theme, which is not this theme.- if ($hook == 'menu__main') { // We're doing that for main menu. + if ($hook == 'menu__main') { + // We're doing that for main menu. // Get the current path. $current_path = \Drupal::request()->getRequestUri();
Those comments are not necessary, as they describe what is already clear from the code. There is no need to say the code is getting the current path when it is setting the
$current_path
variable, nor to say the code is for the main menu when there is$hook == 'menu_main'
.- $pt = \Drupal::hasService('extension.path.resolver') ? - \Drupal::service('extension.path.resolver')->getPath('theme','ekam') : drupal_get_path('theme','ekam'); + $pt = \Drupal::hasService('extension.path.resolver') ? + \Drupal::service('extension.path.resolver')->getPath('theme', 'ekam') : drupal_get_path('theme', 'ekam');
I would leave the code as it is, since code lines are allowed to exceed 80 characters, if they are easier to understand.
If the code is going to be split in two lines, the second line must be indented, or it seems an independent line, not a continuation of the previous line./** - * @param $suggestions - * @param array $variables + * Param $suggestions, Param array $variables. */
Parameters are described with
@param
, notParam
. That is not the comment used for hook implementations, though./** - * @param array $variables + * Param array $variables. */ function ekam_preprocess_form_element(&$variables) {
The documentation comment should be similar to the following one, used for
claro_preprocess_menu_local_action()
./** * Implements hook_preprocess_HOOK() for menu-local-action templates. */
/** - * @param $suggestions - * @param array $variables + * Param $suggestions, Param array $variables. */ function ekam_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
It is the same wrong change already reported.
/** - * This function generates the body id for the preprocess_html function + * This function generates the body id for the preprocess_html function. */
The
@return
line is missing.
the preprocess_html function is a wrong description, since that is either a hook or a template function. There is not anypreprocess_html()
function.+ // Get the url because. + // $url = \Drupal::service('path.current')->getPath(); $url = trim($_SERVER['REQUEST_URI']); - //clean whitespace + // Clean whitespace. $url = str_replace(" ", "", $url); - //if there is a question mark + // If there is a question mark. $url = str_replace("?", "/", $url); - //explode into an array + // Explode into an array. $url_array = explode('/', $url); - //adding the different paths to a long unique id + // Adding the different paths to a long unique id.
Except for Need to clean this up a bit at some point.. which should be @todo Clean this up., the other comments are not necessary.
+ // This is here because the id search is used on the search page. + if ($body_id == "search") { + $body_id = "search-page"; }
That comment can be removed.
As a side note, the patch/MR should be created for the 8.2.x branch.