Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locating page-specific layout HTML #2547

Closed
JAyenGreen opened this issue Feb 19, 2017 · 2 comments
Closed

Locating page-specific layout HTML #2547

JAyenGreen opened this issue Feb 19, 2017 · 2 comments

Comments

@JAyenGreen
Copy link

I need to add a div to my page, and have that div be a child of the body, i.e. not a div added to a block that then is generations-removed from the body tag.

I see that hook_page_alter has been removed (congrats...it was ugly), so template.php is not the right place.

I also see that page--my-page.tpl.php is no longer possible.

I read that the way to go is to create a new layout (done), assign it to the page path (done), and select the format (done...Boxton). That all done, I can't find anything that tells me in which folder I would find or need to add the layout file that is the path-specific version of layout--boxton.tpl.php, in which I can add the markup.

@Al-Rozhkov
Copy link
Member

You need to modify template.php file in your theme. Add hook_preprocess_layout function if it doesn't exist yet.

function YOUR_THEME_preprocess_layout(&$variables) {
  $original = $variables['theme_hook_original'];
  $variables['theme_hook_suggestions'][] = $original . '__' . $variables['layout']->name;
}

In your case use layout--boxton--LAYOUT_MACHINE_NAME.tpl.php for your layout template file.

@ghost
Copy link

ghost commented Mar 26, 2022

Since this question has been answered and there's been no followup, I'll close this issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants