Currently, we can add the message on entity create/update/delete. Though users can add tokens, it would be great if we can see available tokens.

Comments

pratik_kamble created an issue. See original summary.

pratik_kamble’s picture

Starting work on it.

msuthars’s picture

Assigned: pratik_kamble » msuthars
msuthars’s picture

StatusFileSize
new3.45 KB

I created a patch where I used the token module to show the available tokens.

msuthars’s picture

Status: Active » Needs review
msuthars’s picture

Assigned: msuthars » Unassigned
pratik_kamble’s picture

Issue summary: View changes

@msuthars, Thanks for the patch. There are some modifications that need to be done.
Please check the below reports.

FILE: ...8os/web/modules/contrib/notify_to_slack/notify_to_slack.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | WARNING | All dependencies must be prefixed with the project
   |         | name, for example "drupal:"
----------------------------------------------------------------------


FILE: ...os/web/modules/contrib/notify_to_slack/src/Form/SettingsForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
   9 | ERROR   | [x] There must be one blank line after the last USE
     |         |     statement; 0 found;
  67 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  73 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
 146 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
 185 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
msuthars’s picture

Assigned: Unassigned » msuthars
Status: Needs review » Active
pratik_kamble’s picture

Status: Active » Needs work
pratik_kamble’s picture

Issue summary: View changes
msuthars’s picture

StatusFileSize
new5.18 KB

Drupal coding standard changes.

msuthars’s picture

Assigned: msuthars » Unassigned
Status: Needs work » Needs review
naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Status: Needs review » Needs work
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.63 KB

Hi @msuthars,
I have added a composer file to manage the dependencies of this module. Please find the attached modified patch.

naresh_bavaskar’s picture

Status: Needs review » Reviewed & tested by the community
Lal_’s picture

Status: Reviewed & tested by the community » Needs review

I might be wrong but I think an update hook is needed to check if the module is enabled for the existing site... or this could an another release.

msuthars’s picture

@lal_ I don't think so we need to add an update hook, because we already added the condition according to the token module in code. So if the token module is not available then it will be handled according to condition.

pratik_kamble’s picture

@msuthars and @naresh_bavaskar, I don't see any token module in drupal core. It is part as the utility. Update info file to contain token:token as dependency (Contrib Module). Let's create hook_update() to enable the token module. Remove the code to check token module is enabled or not in the Form.

Node, User and Site Information token types should be available.

pratik_kamble’s picture

Status: Needs review » Needs work
naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.86 KB

@pratik_kamble @lal
Enabled dependent token module as a dependency and removed token condition module in the above patch. Please have a look into it

pratik_kamble’s picture

Status: Needs review » Needs work

@naresh_bavaskar in notify_to_slack.info.yml it should be `token:token` as the dependency.

snehalgaikwad’s picture

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

Global tokens are added and dependency changed from drupal:token to token:token.

pratik_kamble’s picture

Status: Needs review » Fixed
naresh_bavaskar’s picture

Status: Fixed » Needs work

@snehal
one minor change is required in hook_update
there is typo hook_update (token1)

pratik_kamble’s picture

Status: Needs work » Fixed

@naresh_bavaskar, thanks for pointing out the issue. I have fixed it.

pratik_kamble’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.