1

I am new to drupal 7 theming. I see that there is a variable called $page_top in html.tpl.php file, which contains HTML markup for the header section of the body. I want to override this and print my markup. How can I do that in template.php file, or is there any other way?

1

you can use hook_preprocess_html() like this :

function hook_preprocess_html(&$vars) { $vars['page']['page_top'][] = array('foo' => array('#markup' => 'foo')); // Or other render array stuff }

1

You override markup by using :

  function template_preprocess_field(&$vars){ 
    if($vars['element']['#field_name'] == 'field_event_geofield')
     {
          //kpr($vars); //Uncomment to output the $vars array.

           if(isset($vars['element']['#items']['0']['lat']) && isset($vars['element']['#items']['0']['lon'])) { $vars['items']['0']['#markup'] = 'View Map'; } return; } 
           } 

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.