We aren't supposed to use the word "node" in the user interface for Drupal 7. See http://drupal.org/node/604342

On the triggers admin page, the word "Node" is used as the tab title for the node-related triggers. (admin/structure/trigger/node -- see screen shot attached).

Probably the only way to fix this is rather ad-hoc but it should still be fixed...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Issue tags: +ui-text

forgot tag

Bojhan’s picture

I am not sure if this is truly a bug, our goal is indeed to avoid useage of Node - however it is a goal, whenever the context says us to do different we most definitely should. The trigger UI in that sense, to me applies to a different context - which is of building relationship models of objects (Content item ID) would be one to go for, however it is technically incorrect to call this tab Content (as it would house the object, comment to).

jhodgdon’s picture

Well, I think this is truly the only place in the entire UI that the word "Node" appears, aside from the term "Node module", which is the name of node.module...

jhodgdon’s picture

Also, just as a note, the help text for the page says something about actions related to "content". Should that also be changed to say "node"?

And if we are going to have the word "node" appear so prominently as a tab, I think we need to define it in the node.module help file.

Bojhan’s picture

Hmm, this is hard. I am not sure, hope someone else will chime in.

jhodgdon’s picture

Status: Active » Needs review
FileSize
21.61 KB
6.48 KB

OK, I have a solution. The tabs on the Triggers page are module names, and the Node module is still the name of that module, for better or for worse.

So I changed around the help to say that there's a tab for each module and to link to the module's main help screen. This involved a slight refactor of the code in trigger_menu() that generates the tabs, to avoid writing the same code twice.

Here's a patch and a screen shot.

Status: Needs review » Needs work

The last submitted patch, 678606.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Needs review
FileSize
6.49 KB

Here's a patch with a slight change so it now passes the tests, at least on my install.

Bojhan’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, RTBC

cosmicdreams’s picture

Issue tags: -ui-text

#8: 678606fix.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work
Issue tags: +ui-text

The last submitted patch, 678606fix.patch, failed testing.

cosmicdreams’s picture

here's the .rej I get when I try to apply this patch:

***************
*** 619,621 ****
    return $triggers;
  }

--- 607,639 ----
    return $triggers;
  }

+ /**
+  * Gathers information about tabs on the triggers administration screen.
+  *
+  * @return
+  *    Array of modules that have triggers, with the keys being the
+  *    machine-readable name of the module, and the values being the
+  *    human-readable name of the module.
+  */
+ function _trigger_tab_information() {
+
+   // Gather the trigger information.
+   $trigger_info = module_invoke_all('trigger_info');
+   drupal_alter('trigger_info', $trigger_info);
+
+   $return_info = array();
+   foreach ($trigger_info as $module => $hooks) {
+     $info = db_select('system')
+       ->fields('system', array('info'))
+       ->condition('name', $module)
+       ->condition('status', 1)
+       ->execute()
+       ->fetchField();
+     if ($info) {
+       $info = unserialize($info);
+       $return_info[$module] = $info['name'];
+     }
+   }
+
+   return $return_info;
+ }

andypost’s picture

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
6.49 KB

Here is a straight reroll of the patch above. It was RTBC before.

andypost’s picture

Why not use system_list() against querying database?

jhodgdon’s picture

Probably a good idea. Care to make a new patch?

andypost’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
9.29 KB

Re-roll, fixed indent in hook_help()

_trigger_tab_information() now uses API to get triggers and modules info

andypost’s picture

Fixed indent for doc-block

andypost’s picture

I think better to query only modules that have triggers because this lead to less memory consumption

jhodgdon’s picture

So, you've basically gone back to my patch in #14 after all? I am having trouble seeing the differences...

andypost’s picture

Main difference that my patch uses only 1 query and a bit indent fixes.

jhodgdon’s picture

OK. I'll need to test it out and make sure it actually works (i.e. look at the help screens). The code looks fine though.

If you want to save some time and post screen shots of the Trigger module main help page, and the admin/structure/trigger/* pages (probably one is enough, like in #6 above), that could speed this patch along. Just want to make sure it still does the same thing.

andypost’s picture

Screens are looks the same except a link at the bottom of help text

andypost’s picture

Issue tags: +Performance, +triggers

This also a performance improvement because 5 queries are going to be 1 in hook_menu()

Also we need seting for MENU_DEFAULT_LOCAL_TASK as proposed in #544318-12: Rework trigger_menu()

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Performance, -triggers

I don't think it's a performance improvement over what was in core previously -- it's just a performance improvement against my other patch. And since this is in the trigger component, it shouldn't need a trigger tag.

Thanks for the screen shots, showing that the patch works. I agree it's improved over my version above, and it works the same. Since the text was already approved, let's get this in before HEAD changes again...

andypost’s picture

Issue tags: +Performance

Current implementation make a query per each module that defines hook_trigger_info()
You could see foreach() loop with db_select() inside http://api.drupal.org/api/function/trigger_menu/7

Damien Tournoud’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Performance, -ui-text

We cannot do that.

1. It's really not a performance improvement, as hook_menu() is only called when regenerating the menu
2. Just call system_get_info() here, instead of trying to write a SQL query by yourself

andypost’s picture

Status: Needs work » Needs review
FileSize
9.27 KB

Re-roll with system_get_info()

andypost’s picture

#28: 678606-trigger-menu-d7.patch queued for re-testing.

jhodgdon’s picture

Issue tags: +String freeze, +ui-text

tagging

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

I think all of the concerns about this have been addressed.

webchick’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs work

Well, that's certainly... interesting... code there to work around this bug. :) Oh, Trigger module...

I spoke with Jennifer about this in IRC. Unlike #690622: Word "node" is still being used all over Drupal 7... where the word "node" is clearly appearing in human-facing sentences where it ought not to be, this one is a bit more borderline:

+  foreach ($trigger_info as $module => $module_name) {
+    $items["admin/structure/trigger/$module"] = array(
+      'title' => $module_name,

We actually do want the module name there, which is Node. "Content" module is a different thing. Unlike those other strings, this is a site-builder/developer-hybrid facing page.

But even aside from those general misgivings, the patch includes this hunk:

-  // We want contributed modules to be able to describe
-  // their hooks and have actions assignable to them.
-  $trigger_info = module_invoke_all('trigger_info');
-  drupal_alter('trigger_info', $trigger_info);

...with no corresponding + hunks. I'm sure it's not intentional to remove this hook (if it was, we should remove the trigger.api.php reference, too), so this doesn't quite pass my RTBC smell test.

So rather than trying to rush this in when it's already somewhat borderline, I'm going to kick this to D8. Jennifer seemed cool with it in IRC too, stating that people should just be using Rules anyway. :D

jhodgdon’s picture

Actually, I jsut realized the drupal_alter call is now in
http://api.drupal.org/api/drupal/modules--trigger--trigger.module/functi...

which is what is replacing that hunk (centralization++)

So maybe we could get this in... but I'm not ready to fight for it, so I guess not.

EDIT- added:

To clarify, the hunk with the alter call is being replaced by a call to a new function _trigger_tab_information() , which calls _trigger_get_all_info(), which does the drupal_alter.

No alters were killed in the above patch.

jhodgdon’s picture

Title: Word "node" appearing as tab title on Triggers admin page » Tab titles on Trigger page are not clear
Version: 8.x-dev » 7.x-dev
Status: Needs work » Reviewed & tested by the community

And just to clarify, changing the title.

What this patch actually does/did is:
a) Use the human-readable name of each module as the tab name
b) Standardize the help text so it clarifies what the tabs are and links to each module's help page.
c) Cleans up the code in the hook_menu() implementation, using system calls instead of queries.

Maybe we should move it back to D7 after all?

(webchick: don't shoot me, please! You can override and move back to D8 if you want, and I won't complain. Sorry I was pressed for time in IRC earlier and didn't have time to figure this out then...)

andypost’s picture

+1 for d7, there's no api changes and introduced strings cleanup just make a translators job a bit easy

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oh, ok. Upon actually testing it, I can see that it doesn't change the "Node" title at all, and it is indeed just internal re-organization of some stuff and getting rid of a bunch of almost-duplicate strings.

I still think this looks a little funny, but on the other hand it's "just" Trigger module, so is unlikely to seriously hurt anyone.

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -String freeze, -ui-text

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