Commit 8440c048 authored by jrockowitz's avatar jrockowitz

Use field title and description to single element instances.

parent 27360aff
......@@ -86,7 +86,7 @@ class BlockFieldWidget extends WidgetBase {
$element['plugin_id'] = [
'#type' => 'select',
'#title' => $this->t('ID'),
'#title' => $this->t('Block'),
'#options' => $options,
'#empty_option' => $this->t('- None -'),
'#default_value' => $item->plugin_id,
......@@ -120,6 +120,19 @@ class BlockFieldWidget extends WidgetBase {
return $element;
}
/**
* {@inheritdoc}
*/
protected function formSingleElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formSingleElement($items, $delta, $element, $form, $form_state);
// For single element set the plugin id title and description to use the
// field's title and description.
$element['plugin_id']['#title'] = $element['#title'];
$element['plugin_id']['#title_display'] = $element['#title_display'];
$element['plugin_id']['#description'] = $element['#description'];
return $element;
}
/**
* Ajax callback that return block configuration setting form.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment