$form['#tree'
] = TRUE;
$form['settings'
] =
[];
$subform_state = SubformState::
createForSubform($form['settings'
],
$form,
$form_state);
$form['settings'
] =
$this->
getPluginForm($entity->
getPlugin())->
buildConfigurationForm($form['settings'
],
$subform_state);
$form['visibility'
] =
$this->
buildVisibilityInterface([],
$form_state);
// If creating a new block, calculate a safe default machine name.
$form['id'
] =
[ '#type' => 'machine_name',
'#maxlength' => 64,
'#description' =>
$this->
t('A unique name for this block instance. Must be alpha-numeric and underscore separated.'
),
'#default_value' => !
$entity->
isNew() ?
$entity->
id() :
$this->
getUniqueMachineName($entity),
'#machine_name' =>
[ 'exists' => '\Drupal\block\Entity\Block::load',
'replace_pattern' => '[^a-z0-9_.]+',
'source' =>
['settings', 'label'
],
],
'#required' => TRUE,
'#disabled' => !
$entity->
isNew(),
];
// Theme settings.
if ($theme =
$entity->
getTheme()) {