Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have defined a path to a section using the menu path "tools" and field_tools_help() is inserting this:
Apply some or all fields of the current bundle to other bundles by copying the field instances.
I guess just a count on the args() would be enough:
if ($args_reverse[0] == 'tools' && count($args_filtered) >= 3) {
This is a fairly generic keyword which would probably match other modules URLs... I was thinking menu_get_item() could be used, but nothing instantly obvious is returned to use without parsing the page callback / args. A bit verbose but maybe:
// Someone had the stupid idea to allow saving objects in the callbacks, bloating the cache and generating stale data... anyways...
if (!empty(empty($item['page_arguments'][0])) && is_scalar($item['page_arguments'][0])) {
switch ($item['page_callback'] . ':' . $item['page_arguments'][0]) {
case 'drupal_get_form:field_tools_bundle_fields_clone_from_form':
return 'This is really the tools page!';
}
}
Comment | File | Size | Author |
---|---|---|---|
#6 | 2228669.field_tools.hook-help-path.patch | 1.64 KB | joachim |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedComment #2
Alan D. CreditAttribution: Alan D. commentedBTW, one menu path that this incorrectly targets is: admin/reports/fields/tools
Comment #3
joachim CreditAttribution: joachim commented> BTW, one menu path that this incorrectly targets is: admin/reports/fields/tools
LOL!
Thanks for reporting this and doing some digging.
IIRC this is shown on paths that will have a bundle argument in them somewhere: admin/structure/whatever/BUNDLE/fields/tools, no? Could we check $args_reverse[2ish] and see if that's the name of a bundle?
Alternatively, we could get the list of ALL field admin paths out of hook_entity_info() -- in [bundles][admin][path] -- and just see if we're in that list.
Comment #4
Alan D. CreditAttribution: Alan D. commentedmaybe a simple regex? less chance of conflict (but still possible)
Or even better, maybe the menu item :)
Comment #5
Alan D. CreditAttribution: Alan D. commentedSo using the menu item, something like this (leaving you to fill the blanks)?
Comment #6
joachim CreditAttribution: joachim commentedCommitting this patch.