Add a Read-Only field to User Register Form
To create a read-only field on the user registration form in Drupal, for instance to add a Terms & Conditions textarea field, you must override the form_alter hook.
function
if ($form_id == 'user_register_form') {
$form['field_developer_agreement']['und'][0]['value']['#attributes']['readonly'] = 'readonly';
$form['field_developer_agreement']['und'][0]['value']['#resizable'] = FALSE;
$form['field_developer_agreement']['und'][0]['value']['#cols'] = 40;
}
}
The form_id can be found by adding the following code to the form_alter hook.
function
drupal_set_message("This is the form id : $form_id");
}
Modify Breadcrumb and using Breadcrumb by Path
function
$links = array();
$path = '';
// Get URL arguments
$arguments = explode('/', request_uri());
// Remove empty values
foreach ($arguments as $key => $value) {
if (empty($value)) {
unset($arguments[$key]);
}
}
$arguments = array_values($arguments);
// Add a 'Home' link to breadcrumb
$links[] = l(t('Home'), '
// Add other links
if (!empty($arguments)) {
foreach ($arguments as $key => $value) {
// Don't make last breadcrumb a link but set to page title
if ($key == (count($arguments) - 1)) {
// if last breadcrumb
$links[] = drupal_get_title();
} else {
// create path to set link
if (!empty($path)) {
$path .= '/'. $value;
} else {
$path .= $value;
}
// customize format of breadcrumb values
// replace hyphens by spaces
$cvalue =str_replace('-', ' ', $value);
// create linked breadcrumb value
$links[] = l(ucwords($cvalue), $path);
}
}
}
}