Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Rassoni created an issue. See original summary.

rassoni’s picture

Status: Needs work » Needs review

Fixed PHPCS issues and generate MR
https://git.drupalcode.org/project/logout_redirect/-/merge_requests/1
Please review.

avpaderno’s picture

Status: Needs review » Needs work
-Enter url on which you wants to redirect user after logging off and if 
+Enter url on which you wants to redirect user after logging off and if

Since that line is changed, the change should also correctly spell URL and use redirect users instead of redirect user.

 /**
  * @file
- * This module After user logout if user click browser back button then redirect to login page.
+ * User click browser back button then redirect to login page.
  *
- * Administrators can add url of page on which he want's to ,
+ * Administrators can add url of page on which wants to
  * redirect if browser back button is clicked after logout.
  */

The usual comment is Hook implementations for [module name]. It does not need to explain the module purpose, which is already explained in its hook_help() implementation.

-    // Markup for example
+    // Markup for example.
     $form['explaination_text'] = [
       '#type' => 'markup',
       '#markup' => $explaination_text,

That comment can be removed, since it does not explain anything already understandable from the code.

+    $form['redirect'] = [
       '#type' => 'textfield',
-      '#title' => $this->t("Add url of page on which you want's to  "
-          . "redirect if browser back button is clicked after logout"),
-      //'#required' => TRUE,
+      '#title' => $this->t("Add url of page on which you want's to redirect if browser back button is clicked after logout"),
+     // '#required' => TRUE,
       '#default_value' => $config->get('logout_redirect'),
-    );
+    ];

Commented out code should be simply removed.

kkalashnikov made their first commit to this issue’s fork.

kunalgautam’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work
 /**
  * @file
- * This module After user logout if user click browser back button then redirect to login page.
- *
- * Administrators can add url of page on which he want's to ,
- * redirect if browser back button is clicked after logout.
+ * Hook implementation for the logout_redirect module.
  */

It is Hook implementations and the module name should be shown as shown on the top of this page.

-    // Markup for explaination
-    $explaination_text = "<div>If you log out of a Drupal site and then hit 
-      the back button, you can see pages from the authenticated user's previous 
+    // Markup for explanation.

The last comment is not necessary, since that is already clear from the code.

+      '#title' => $this->t("Add url of page on which you want's to
+        redirect if browser back button is clicked after logout"),
       '#default_value' => $config->get('logout_redirect'),

url is not the correct spelling of URL.
you want's to, while used in the original comment, is not grammatical.
redirect if browser back button is clicked after logout is missing an article, not using the possessive, and it would probably say after users logged out.

-    // Submit button
+    // Submit button.

It should be The submission button, but that comment is not necessary, since that is evident from the code.

+      // Set the submitted configuration setting.
+      ->set('logout_redirect', $logout_redirect_url)
+      ->save();

That comment should be placed some lines earlier, but it is not necessary, as that is understandable from the code itself.

kunalgautam’s picture

Status: Needs work » Needs review

@apaderno I have updated the MR accordingly please review it.

avpaderno’s picture

Status: Needs review » Needs work
-Enter url on which you wants to redirect user after logging off and if 
+Enter URL on which you wants to redirect users after logging off and if
 user press browser back button.

That sentence is still not grammatically correct. Those errors need to be corrected, since that comment is changed.
A correct sentence would be:

Enter the URL to which you want to redirect users after they log off or when they press the browser's Back button.

+ * Hook implementations for the logout_redirect module.

The module name is not logout_redirect; that is its machine name. The module name is the one reported after Project: on the top of this page, which is the same name reported in the module's .info.yml file (the value for the name key).

+      '#title' => $this->t("Add URL of page on which you want's to
+        redirect if browser back button is clicked after logout"),
       '#default_value' => $config->get('logout_redirect'),

you want's to is not grammatical. Since that line is edited, that should be corrected too.

kunalgautam’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work
+Enter the URL of page on which user wants to redirect if browser back button is
+clicked after logout.
+

That could be grammatically correct, but it is not correct. It's not the user who wants to redirect, but the administrator user who is entering the URL.

- * Administrators can add url of page on which he want's to ,
- * redirect if browser back button is clicked after logout.
+ * Hook implementations for the logout redirect module.
  */

The module name should be spelled using uppercase letters where the module name uses them.

-      '#title' => $this->t("Add url of page on which you want's to  "
-          . "redirect if browser back button is clicked after logout"),
-      //'#required' => TRUE,
+      '#title' => $this->t("Add URL of page on which user wants to
+        redirect if browser back button is clicked after logout"),
       '#default_value' => $config->get('logout_redirect'),

It is the same mistake done for the previous change.

hardik_patel_12’s picture

Status: Needs work » Needs review
StatusFileSize
new5.53 KB

I have solved the warnings given by PHPCS and here is the patch.

avpaderno’s picture

Version: 2.0.0 » 2.0.1
Status: Needs review » Needs work
 /**
  * @file
- * This module After user logout if user click browser back button then redirect to login page.
+ * This module After user logout if user click browser back button
+ *  then redirect to login page.
  *
- * Administrators can add url of page on which he want's to ,
- * redirect if browser back button is clicked after logout.
+ * Hook implementations for the logout redirect module.
  */

The module name is Logout Redirect, not logout redirect. Capitalized letter must be written capitalized.
Furthermore, the @file description for a module is just the last line.

avpaderno’s picture

Issue summary: View changes
Issue tags: +Needs reroll

Furthermore, running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ./, I get a slightly different report.

yashaswi18’s picture

I cloned and ran the command :
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml logout_redirect/
I'm not seeing any errors except for this one.

--------------------------------------------------------------------------------
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
------------------------------------------------------------
chaitanyadessai’s picture

Status: Needs work » Needs review
StatusFileSize
new57.92 KB
new7 KB

Please review patch.

avpaderno’s picture

Status: Needs review » Needs work
-core: 8.x
 core_version_requirement: ^8 || ^9

It is not necessary to remove the core line, if the core_version_requirement line is not changed.

- * Rename wrong name of the config from logut_redirect_config.settings
- * to logout_redirect.settings.
+ * To logout_redirect.settings.

That change is not correct, since to logout_redirect.settings is not a sentence on its own. It is part of the previous sentence.

 /**
  * @file
- * This module After user logout if user click browser back button then redirect to login page.
- *
- * Administrators can add url of page on which he want's to ,
- * redirect if browser back button is clicked after logout.
+ * This module After user logout if user click browser back button.
  */
 
+// Then redirect back to login page.
+// Administrators can add page url's as per requirement.
+// redirect if browser back button is clicked after logout.

The usual description for a module file is Hook implementations for the [module name] module. where [module name] is the module name reported in its .info.yml file.

Outside of functions or classes, the comment delimiter used is not //. We use a single documentation comment per function/method.

+    // Validate if the redirect field is not empty.
+    $redirect_value = $form_state->getValue('redirect');
+    if (empty($redirect_value)) {
+      $form_state->setErrorByName('redirect', $this->t('Redirect URL is required.'));
+    }

Verify the redirect field is not empty. is better.

Also, let's keep using merge requests.

nitin_lama’s picture

Assigned: Unassigned » nitin_lama
nitin_lama’s picture

StatusFileSize
new6.58 KB

Addressed #18. Providing updated patch.

nitin_lama’s picture

Status: Needs work » Needs review

Please review. Thanks.

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
yashaswi18’s picture

Hello, applied MR!2, found one error remaining on running the command phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml

FILE: /home/yashaswi/contribs/logout_redirect/logout_redirect.install
------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
 11 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
------------------------------------------------------------------------------------------------------------------

apaderno changed the visibility of the branch logout_redirect-3349252 to hidden.

silvi.addweb made their first commit to this issue’s fork.

cleavinjosh’s picture

Status: Needs review » Needs work

Hi @silvi.addweb,

I tried to apply MR!2 but was skipped.

➜  logout_redirect git:(main) ✗ curl https://git.drupalcode.org/project/logout_redirect/-/merge_requests/2.diff | git apply -v
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14587    0 14587    0     0  41157      0 --:--:-- --:--:-- --:--:-- 41206
Skipped patch '.gitlab-ci.yml'.
Skipped patch 'README.txt'.
Skipped patch 'logout_redirect.info.yml'.
Skipped patch 'logout_redirect.install'.
Skipped patch 'logout_redirect.libraries.yml'.
Skipped patch 'logout_redirect.module'.
Skipped patch 'logout_redirect.routing.yml'.
Skipped patch 'src/Form/LogoutBackConfigForm.php'.
➜  logout_redirect git:(main) ✗

Please check and advise.
Thank you.

avpaderno’s picture

Status: Needs work » Needs review

The issue fork is eight commits ahead of the upstream repository. There is nothing that needs to be fixed in the MR.

avpaderno’s picture

roberttabigue’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new44.55 KB

Hi,

I have applied the latest MR to the Logout Redirect module against 2.0.1 on Drupal 10 and confirmed all PHPCS errors have been fixed.

I ran this command on the module:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml logout_redirect

Please see the attached file for reference.

I'm moving this now to ‘RTBC’.

Thank you!

prem suthar made their first commit to this issue’s fork.

avpaderno’s picture

Issue tags: -Needs reroll

avpaderno’s picture

Issue summary: View changes

avpaderno changed the visibility of the branch 8.x-1.x to hidden.