Created on 3 May 2022, almost 3 years ago
Updated 6 February 2024, about 1 year ago

Problem/Motivation

The current functionality is fine for simple use cases, but it is very limiting for real world use.

Proposed resolution

Provide a way of adding fields.

Remaining tasks

Work out how to add fields.

User interface changes

TBD

API changes

TBD

Data model changes

TBD

✨ Feature request
Status

Closed: works as designed

Version

1.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Simple Block provides config entities that don't support adding fields.

    as a custom solution, you can add a new property via hook_ENTITY_TYPE_alter(&$entity_types) hook.

    e.g.

    $configs = $entity_types['simple_block']->get('config_export');
    $configs[] = 'category';
    $entity_types['simple_block']->set('config_export', $configs);
    

    then you can render the field via form alter hook and use it wherever you want
    e.g.

    $category = $form_state->getFormObject()->getEntity();
    $form['category'] = [
      '#title' => t('Category'),
      ...
      '#default_value' => $category->get('category'),
    ];
    
Production build 0.71.5 2024