public function EmergencyForm::buildForm in Display Suite 8.2
Same name and namespace in other branches
- 8.4 src/Form/EmergencyForm.php \Drupal\ds\Form\EmergencyForm::buildForm()
- 8.3 src/Form/EmergencyForm.php \Drupal\ds\Form\EmergencyForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ EmergencyForm.php, line 68
Class
- EmergencyForm
- Emergency form for DS.
Namespace
Drupal\ds\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['ds_fields_error'] = array(
'#type' => 'fieldset',
'#title' => $this
->t('Fields error'),
);
$form['ds_fields_error']['disable'] = array(
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => $this
->t('In case you get an error after configuring a layout printing a message like "Fatal error: Unsupported operand types", you can temporarily disable adding fields from DS. You probably are trying to render an node inside a node, for instance through a view, which is simply not possible. See <a href="http://drupal.org/node/1264386">http://drupal.org/node/1264386</a>.'),
);
$form['ds_fields_error']['submit'] = array(
'#type' => 'submit',
'#value' => $this->state
->get('ds.disabled', FALSE) ? $this
->t('Enable attaching fields') : $this
->t('Disable attaching fields'),
'#submit' => array(
'::submitFieldAttach',
),
'#weight' => 1,
);
if ($this->moduleHandler
->moduleExists('ds_extras')) {
$region_blocks = $this
->config('ds_extras.settings')
->get('region_blocks');
if (!empty($region_blocks)) {
$region_blocks_options = array();
foreach ($region_blocks as $key => $info) {
$region_blocks_options[$key] = $info['title'];
}
$form['region_to_block'] = array(
'#type' => 'fieldset',
'#title' => $this
->t('Block regions'),
);
$form['region_to_block']['remove_block_region'] = array(
'#type' => 'checkboxes',
'#options' => $region_blocks_options,
'#description' => $this
->t('In case you renamed a content type, you will not see the configured block regions anymore, however the block on the block settings page is still available. On this screen you can remove orphaned block regions.'),
);
$form['region_to_block']['submit'] = array(
'#type' => 'submit',
'#value' => $this
->t('Remove block regions'),
'#submit' => array(
'::submitRegionToBlock',
),
'#weight' => 1,
);
}
}
return $form;
}