0

I have built a component following the docs but am wanting to add configure to allow the user to add a series of objects that each contain a 'title' (a text field) and a 'content' (a list of text fields) and cannot seem to find this documented anywhere. Ideally the user could select the block and then, in the configuration, add as many afore-mentioned objects to have them all be displayed wherever the block is placed.

Right now the 'hello world' demo in the docs looks like:

$form['hello_block_name'] = [ '#type' => 'textfield', '#title' => $this->t('Who'), '#description' => $this->t('Who do you want to say hello to?'), '#default_value' => isset($config['hello_block_name']) ? $config['hello_block_name'] : '', ];

Any clarification or tips would be greatly appreciated, thanks!

  • 1
    Use webforms: drupal.org/project/webform – Beau Mar 31 at 19:11
  • Not sure that I follow. I was hoping to enable a user to be able to add configuration to a custom block on the admin page, this seems to work on pages. Are you saying I could throw this into the custom block config UI? – av0000 Mar 31 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.