Closed (fixed)
Project:
Pathauto
Version:
7.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2011 at 08:06 UTC
Updated:
3 Jan 2019 at 19:52 UTC
Jump to comment: Most recent
Comments
Comment #1
Wappie08 commentedComment #2
dave reidYou have to ensure that your code gets run after path_form_node_form_alter().
In order of execution: hook_form_alter(), hook_form_BASE_FORM_ID_alter(), and then hook_form_FORM_ID_alter().
So your best bet is to use hook_form_page_node_form_alter() to modify $form['path'].
Comment #3
Wappie08 commentedHi Dave, thanks for the quick reply! But theres still no $form['path'] in hook_form_FORM_ID_alter(), I also searched for another variablename but everything seems to be there exept path..
Comment #4
Wappie08 commentedStill can't find a way to hide path settings, I can hide everything else with form_alter, does anybody got this working?
Greets
Comment #5
stevek123 commentedI'm having the same problem. I can hide everything except "URL path settings" in my edit form for a "child" node. Here is the code in node.module (please note: the content type is "child"):
function node_form_alter(&$form, &$form_state, $form_id) {
if($form_id == 'child_node_form') {
$form['field_child_node']['#access'] = false;
$form['revision_information']['#access'] = false;
$form['options']['#access'] = false;
$form['path']['#access'] = false;
$form['comment_settings']['#access'] = false;
$form['author']['#access'] = false;
}
}
Thanks for any assistance.
Comment #6
stevek123 commentedI don't know why, because I haven't taken the time to walk through the code yet, but this module, http://drupal.org/project/nodeformsettings, seems to work for hiding the path prompt on forms. After installing and enabling the modle, go to the relevant content type and click the "edit" link for the content type. A new link for "Node form settings" will allow you to hide the "Path" field, along with others.
Comment #7
dave reid@stevek123: That's because core's URL alias 'path' fieldset gets added in path_form_alter, which runs after your node_form_alter since both modules have a weight of 0 and p > n alphabetically.
Comment #8
dave reid#7 also answers the original comment
Comment #9
Wappie08 commentedThanks very much, I'll give my module some weight :)
Comment #11
hellomobe commentedSorry to reopen. My custom module has a weight of 99. I'm still not able to get the $form['path'] disabled with hook_form_FORM_ID_alter(). Please advise.
Comment #12
KayBe commentedThese menu items are added to the form after the alter of the form takes place. You can use an after build to hide these menu's.
In your alter:
This will remove the items from the form after the build of the form is created.
Regards,
Kris
Comment #13
bethhauck commentedAfter build works great, thanks for the explanation, KayBe!
Comment #14
Tony Finlay commentedCan you explain a little further how answer #12 works and if it'll work for taxonomy_term_form?
Thanks
Comment #15
dave reidSolution provided in #12.
Comment #17
newme154 commentedI have a view that has a link as one of the fields. the display shows the entire link path i.e, http://www.example.com/user i want just the /user to show up in the view. is this something that requires a rewrite or a creation of a template? any ideas?
Comment #18
dave reid@newme154: Please file a support request in Views. This seems unrelated to Pathauto, and you are posting on an issue which has been marked closed/resolved for over a year.
Comment #19
mitchelljj commented#12 works great for taxonomy terms!!!!!