User login

theme

How to get the base path for your Drupal 8 site in a Twig template

In page.html.twig you will have a working {{ base_path }} variable. Why it isn't available in every template, i have no idea. As i think it should be and everything else looks messy, my preferred solution is to do exactly as Drupal does in the preprocess page function for any place i need it.

Use different view mode based on theme

[PARTIAL RESOLUTION]

Both these are needed to work for teaser nodes in a view, at least:

Preprocess from a module: removing the content author from Drupal 7 search results

All, not just most, but all the content on a particular site was set to be posted without showing the by-line or submitted by text. Given this requirement, it makes no sense to have search results show the user that submitted the content, every time. This can be themed away in search-result.tpl.php or it can be removed with a pre-process function as shown below.

You can do this from a module or a theme, where 'example' is the system name of that module or theme:

Configuring blocks for your admin theme

Drupal 6 introduces the feature of choosing an administration theme, and it can be any theme that is physically present in your Drupal installation; it does not have to be enabled. You simply select the theme at admin/settings/admin

However, to modify which blocks are in which region, to have the theme show up on the configure blocks page at admin/build/blocks, you must enable the theme at admin/build/themes (once you are done you can disable it again).

Remove page headline for a given content type

To remove the page title (the one that prints in the page itself, not in the browser bar) for a specific node type, use this simple code in your template_preprocess_page() function.

Make sure you wrap the code that outputs the header in page.tpl.php in a conditional if statement, so that if there is no title it does not output the <h1></h1> tags.

This code goes in template.php of a theme named "example":

Theme the Search Form in Drupal 6

So it's 1am and you want to theme the search form output of your brand new drupal 6 theme, here's the quick and easy one step guide that will get you though it. Yep, that's right, 1 step, because that's how we do it the agaric way...

Resolution

STEP 1 of 1
Paste the code below into into your trusty template.php file and customize to your heart's desire... (leave out the php open and closing tags, we use em to make the output look nice, with pretty colors and stuff...)

Syndicate content