Add a section.type to make theme blocks more flexible

Short description of issue

Lack of flexibility with theme blocks

Reproduction steps

Hello,

Starting from our next themes, we are going to embrace theme blocks as much as possible.

We’ve found an issue though that we believe could be fixed relatively easily. One of them is that theme blocks can’t be “customized” per section. In our themes, we have some relatively generic theme blocks such as heading, image, video… with a lot of settings to give them the flexibility we need. However, based on the context, we might want to show/hide some settings that does not make sense.

Right now, our only solution is to duplicate the theme block with some variations, but we loose the benefit of re-usability.

I’d love to be able to hide/show some settings using the visible_if, but it would be nice if section drop would expose a new type property that would return the file name of the section.

This would allow a theme block to hide a specific setting:

{
   "type": "text",
   "visible_if": "{{ section.type != 'rich-text' }}",
   "label": "Accent text"
}

Additional info

N/A

What type of topic is this

Feature request

2 Likes

That would be great.
We’ve hacked around this with a hidden non-translatable setting on the section:

{
  "visible_if": "{{ false }}",
  "id": "section_type",
  "type": "select",
  "label": "Section type",
  "default": "slideshow",
  "options": [
    {
      "value": "slideshow",
      "label": "Slideshow"
    }
  ]
}

I’d really like a better option.

This is super hacky :smiley: . Good work on finding this!