public function SimpleSiteSettingsBlock::blockForm in Site Settings and Labels 8
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ SimpleSiteSettingsBlock.php, line 82
Class
- SimpleSiteSettingsBlock
- Provides a 'SimpleSiteSettingsBlock' block.
Namespace
Drupal\site_settings\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
// Allow selection of a site settings entity type.
$form['setting'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'site_setting_entity_type',
'#title' => $this
->t('Site setting type'),
'#weight' => '20',
'#required' => TRUE,
];
if (isset($this->configuration['setting']) && !empty($this->configuration['setting'])) {
$setting_entity_type = $this->entityTypeManager
->getStorage('site_setting_entity_type')
->load($this->configuration['setting']);
$form['setting']['#default_value'] = $setting_entity_type;
}
return $form;
}