0

admin/config/search/page-title - Global default title is abc

admin/config/search/page-title - Content type BOOK -> title is def

meta tag -> Content -> page title is ghi

meta tag -> Content -> BOOK -> page title is jkl

content type BOOK -> create new node -> page title -> mno

In the website(Content type Book), the title always shows abc.

I want to edit title, may I know how?

Many Thanks.

1
function mytheme_preprocess_page(&$variables) {

  if (!empty($variables['page']['content']['system_main']['#form_id']) && $variables['page']['content']['system_main']['#form_id'] == 'form_id') {
    if (arg(0) == 'node' && arg(2) == 'node-type') {
    drupal_set_title(t('Your title'));
    }
   }
 }

you can use dpm($variables) to find form id. This for changing page title.

For changing header title i.e the title displaying in tab, below code can be used

function mytheme_preprocess_html(&$vars) {
  if (!empty($vars['page']['content']['system_main']['#form_id']) && $vars['page']['content']['system_main']['#form_id'] == 'your_form_id') {
    $vars['head_title'] = t('title');
  }
}
0

Edit

Using this module you can edit your title field.

OR

you can do it by custom

*
 * @form
 * the node form at node/add/[node-type]
 */
function node_entry_form_after_build($form, &$form_state) {


  //set a drupal title here
  drupal_set_title('my title');  


  return $form;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.