When I create a content "Page" eveything goes fine, and there are various fields that are collapsed by default and when clicked, they expand. But I am interested in one field, such as "url Path" field to be expanded by default. Any idea?

Thanks
Waqar

Comments

alim418’s picture

You can use hook_form_alter() and change #collapsed to true

 <?php
$form['contact']['#collapsed'] = TRUE,
?>
wqr786’s picture

Thanks. I'd like to ask where, in which module, I'll have to alter the coding of collapsed to FALSE?

Thanks
Waqar

alim418’s picture

Create a module call "yoursite_general" of you could put in this function in any of your module just change "justsite" to your module name

and put in this function

<?php
function yoursite_general($form_id, &$form) {
  if ($form_id=='page_node_form') {
    $form['path']['#collapsed'] = TRUE;
  }
}
?>
clarkburbidge’s picture

I have been unable to find how to set the URL path settings field of the Pathauto module to display collapsed by default. I am not advanced enough to understand the suggestions of the above comments.

Anyone else have any suggestions?

j3frea’s picture

Inside of your pathauto folder (which you should have put somewhere like /sites/all/modules/pathauto) there's a file called pathauto.module.
Line 290 is:

$form['path']['#collapsed'] = FALSE;

Change FALSE to be TRUE...

Grayside’s picture

The post above has a solid answer.

When you want to customize a Drupal site, it's best to create a unique module for your site and make the changes there. Drupal will pick them up and override code elsewhere. If you hack the changes directly into the pathauto module, you will lose them with the next module update.

P.S. Necromantic Might.