public function NodePreviewFormSelect::alterFormElement in Express 8
The alter method to store the code.
Parameters
\Drupal\bootstrap\Utility\Element $form: The Element object that comprises the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
string $form_id: String representing the name of the form itself. Typically this is the name of the function that generated the form.
Overrides FormBase::alterFormElement
File
- themes/
contrib/ bootstrap/ src/ Plugin/ Form/ NodePreviewFormSelect.php, line 26 - Contains \Drupal\bootstrap\Plugin\Form\NodePreviewFormSelect.
Class
- NodePreviewFormSelect
- Implements hook_form_FORM_ID_alter().
Namespace
Drupal\bootstrap\Plugin\FormCode
public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
$form
->addClass([
'form-inline',
'bg-info',
'text-center',
'clearfix',
]);
// Backlink.
$options = $form->backlink
->getProperty('options', []);
$form->backlink
->addClass(isset($options['attributes']['class']) ? $options['attributes']['class'] : []);
$form->backlink
->addClass([
'btn',
'btn-info',
'pull-left',
]);
$form->backlink
->setButtonSize();
$form->backlink
->setIcon(Bootstrap::glyphicon('chevron-left'));
// Ensure the UUID is set.
if ($uuid = $form->uuid
->getProperty('value')) {
$options['query'] = [
'uuid' => $uuid,
];
}
// Override the options attributes.
$options['attributes'] = $form->backlink
->getAttributes()
->getArrayCopy();
$form->backlink
->setProperty('options', $options);
// View mode.
$form->view_mode
->addClass('pull-right', $form::WRAPPER);
}