Score:0

How to list Links/Attachments in sidebar second

cl flag

When managing fields for a given content type in Drupal 9, I would like to be given the option to list all items of a given field (e.g. Links, Attachments, ... ) in a specific region (say, sidebar second), rather than at the bottom of the page (as is default).

Can this be accomplished by CSS?

Can this maybe be accomplished with the Display Suite module?

Score:0
um flag

The Layout builder module in Drupal core does what you need.

Note that the 2 approaches you mention can work, as well. However, if you don't need other features from Display suite, I think most people would recommend not adding such a huge module when you can accomplish your needs with core. You can also accomplish them with theming, but with significantly more work than Layout builder or Display suite.

All else being equal, I'd go with Layout builder. It lets you define and position content 'sections' and 'blocks' on a page via a User interface. Among the things you can do via this interface, you can set the number of columns, sections and blocks, and choose what content goes in each block.

Here are some instructional resources. I also include a few quick steps below.

basic steps

Give these steps a whirl. The tool is often not immediately intuitive; it's a powerful set of features with a lot of options. The docs/videos will take you much further.

Setup

  1. Enable modules. You can find do so on the Extend page ({yourdomain.com}/admin/modules). Put checks in the boxes next to the following:
    • Layout Builder

      Allows users to add and arrange blocks and content fields directly on the content.

    • Layout Discovery

      Provides a way for modules or themes to register layouts.

    • Field Layout

      Allows users to configure the display and form display by arranging fields in several columns.

  2. Enable Layout builder on the Manage display page of your content type:
    1. for this example, visit the Article Display mode at ({yourdomain.com}/admin/structure/types/manage/article/display/default)
    2. at the bottom of this configuration page, expand Layout options
    3. check the box next to Use layout builder
    4. for this example, select 2 columns
    5. click Manage layout
    6. in the 2nd column, click 'add block'
    7. select the field(s) you want to show in the 2nd column

Verify it works as you expect

  1. Visit an existing Article or create a new one.
  2. Ensure there is content in each field your layout uses. Empty fields can be set not to appear.
Score:0
cn flag

The go-to module for arranging fields on forms is Field Group.

After installing the module, you can go to Manage Form Display for your content type and create field groups.

Advantages of using field groups:

  • Stored as configuration so they can be kept in version control
  • Can be configured in the UI
  • Has options for vertical tabs, horizontal tabs, accordions and so on by default
  • Can easily add classes for further customization

Note that this won't allow you to easily move things to sidebar second-- your form will be printed in the main content region of the theme, and it's not straightforward to print parts of the form UI in different regions-- but it will allow you to customize the layout a lot, and hopefully you can achieve the look you want.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.