// Region settings.
$entity_region =
$entity->
getRegion();
$region =
$entity->
isNew() ?
$this->
getRequest()->query->
get('region',
$entity_region) :
$entity_region;
$form['region'
] =
[ '#type' => 'select',
'#title' =>
$this->
t('Region'
),
'#description' =>
$this->
t('Select the region where this block should be displayed.'
),
'#default_value' =>
$region,
'#required' => TRUE,
'#options' =>
system_region_list($form_state->
getValue('theme',
$theme), REGIONS_VISIBLE
),
'#prefix' => '<div id="edit-block-region-wrapper">',
'#suffix' => '</div>',
];
$form['#attached'
]['library'
][] = 'block/drupal.block.admin';
return $form;
} /**
* Handles switching the available regions based on the selected theme.
*/
public function themeSwitch($form, FormStateInterface
$form_state) {