This forum is for assistance with theme development.

APi Get main menu items

Hi I need to create a side block using the parent items of main menu.

In my file.theme i wrote

$menu_tree = \Drupal::menuTree();
$menu_name = 'main';
// Build the typical default set of menu tree parameters.
$parameters = $menu_tree->getCurrentRouteMenuTreeParameters($menu_name);

// Load the tree based on this set of parameters.
$tree = $menu_tree->load($menu_name, $parameters);

So in my page.html.twig i wrote

{{ dump(tree) }}

But the result is NULL.

What is my error ?

Overriding the Ubercart 3 cart summary block

Hiya,

I'm wondering if anyone could provide any help here. I'm pretty new to the php elements of theming.

I've found a couple of snippets of suggested code, but it all seems to just crash the site with a 500 error.

I'm using a zen sub theme. At this stage I just want to make the cart summary block show less information when unexpanded - and fit on one line.

I've overridden the tpl.php files for a node type and the login block. Ideally I'd like to do the same for the cart summary block, but I've had no luck even getting the template.php to reference it.

Customizing a block template

Is there a way to customize a block template just as there is a way to customize a node template?

For example, I want to create a custom block called "my-custom-block" and place it in my header region of my template.

I'd like to create something similar to "node--my-custom-block.tpl.php" and have the markup render. On a cursory search of the regular resources I can't find a straightforward way to do this - beyond just putting markup in the block body summary field, but that doesn't allow me to do any sort of custom PHP injections.

How to style a sticky node for Drupal 8?

I have a view with one exposed filter ( Display sticky content - Do not display sticky content ) .

The thing is the markup is the same for both types of content. How can i print out a class for the sticky content so i can target it with CSS ? Im guessing this is achievable with twig. Can someone point me in the right direction?

Any help will be greatly appreciated.

Thank you

Dozens of errors reported from my sub-theme. Please help!

I have created a sub-theme of Zurb-Foundation and the front-end displays very well. In fact, I didn't realize I had a problem until I looked at the site reports. I originally thought the issue was a Drupal core problem because the errors point to type: php, and the messages point to core elements.
I get dozens of these errors when I refresh a browser page:

Notice: Array to string conversion in Drupal\Core\Asset\AssetResolver->getLibrariesToLoad() (line 110 of /Users/brett/vhosts/ddclab/core/lib/Drupal/Core/Asset/AssetResolver.php).

Pages

Subscribe with RSS Subscribe to RSS - Theme development