0

I have the "joy" to upgrade a Drupal 6 site to Durpal 8. In my Drupal 8 site I have three different menus, which each display different types of nodes. I want to display them in the region of the sidebar_first, but each of them should have a different background colour. E.g. menu A is red, Menu B is blue and so on. This colour should be in the background if the menu is collapsed and expanded.

I tried it this way:

        {% if page.sidebar_first|render %}
            <div class="sidebar_first">
                <aside id="sidebar-first" class="column sidebar first">
                    {{ page.sidebar_first }}
                </aside>
                <aside id="sidebar-first-person" class="column sidebar first">
                    {{ menu-person }}
                </aside>
                <aside id="sidebar-first-kinder" class="column sidebar first">
                    {{ menu-kinder }}
                </aside>
                <aside id="sidebar-first-kunst" class="column sidebar first">
                    {{ menu-kunst }}
                </aside>
                <!-- /#sidebar-first -->
            </div>
        {% endif %}

But instead of displaying the menu I get a 0. So my guess is that I have to fill the twig placeholder with values somewhere first. Which would be the approach for this? Write a module? Including other Twig templates?

Here you can see the old Drupal 6 site, which I try to rebuild with Drupal 8. http://claudiazeppenfeld.de/kunst/fadenerzaehlungen-fuer-porzellan

In Drupal 6 I achieved this with Blocks and Context. I am not sure to solve that in Drupal 8.

1 Answer 1

0

Why not just add each menus through block layout interface? visit admin/structure/block.

enter image description here

You will get unique id each.

7
  • yes, that is what I did, but I don't get them displayed, although I added them to the "Sidebar first" in the Block layout interface. Those are the names I am referring to in my Twig template. I user Basic theme by the way. Commented May 26, 2016 at 15:04
  • Try using the default theme for comparison. Maybe there is something we can find out. Commented May 27, 2016 at 6:54
  • good idea. The default theme is Bartik? I moved the menus there to the "Sidebar first" and saved it. Now on the start page the menus pop up within the header region in the top right corner. If I click on a menu item a page is shown where all menus, header etc are gone and in the upper half of the page in only my content and in the lower there is the black footer area, which also contains no text whatsoever. Commented May 28, 2016 at 12:45
  • Yup, Bartik is the default. Commented May 28, 2016 at 20:14
  • Hmm that's weird, sidebar first region should be in the left side of the page. Check admin/structure/block/demo/bartik, make sure sidebar first region is in the proper place (left side of the page.) Commented May 28, 2016 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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