public function FieldMultipleValueForm::preprocessElement in Express 8
Preprocess the variables array if an element is present.
Parameters
\Drupal\bootstrap\Utility\Element $element: The Element object.
\Drupal\bootstrap\Utility\Variables $variables: The Variables object.
Overrides PreprocessBase::preprocessElement
File
- themes/
contrib/ bootstrap/ src/ Plugin/ Preprocess/ FieldMultipleValueForm.php, line 25 - Contains \Drupal\bootstrap\Plugin\Preprocess\FieldMultipleValueForm.
Class
- FieldMultipleValueForm
- Pre-processes variables for the "field_multiple_value_form" theme hook.
Namespace
Drupal\bootstrap\Plugin\PreprocessCode
public function preprocessElement(Element $element, Variables $variables) {
// Wrap header columns in label element for Bootstrap.
if ($variables['multiple']) {
$header = [
[
'data' => [
'#prefix' => '<label class="label">',
'title' => [
'#markup' => $element
->getProperty('title'),
],
'#suffix' => '</label>',
],
'colspan' => 2,
'class' => [
'field-label',
!empty($element['#required']) ? 'form-required' : '',
],
],
t('Order', [], [
'context' => 'Sort order',
]),
];
$variables['table']['#header'] = $header;
}
}