public function Margin::buildConfigurationForm in Bootstrap Styles 1.0.x
Overrides StylePluginBase::buildConfigurationForm
File
- src/
Plugin/ BootstrapStyles/ Style/ Margin.php, line 25
Class
- Margin
- Class Margin.
Namespace
Drupal\bootstrap_styles\Plugin\BootstrapStyles\StyleCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$config = $this
->config();
$directions = [
'left',
'top',
'right',
'bottom',
];
$form['spacing']['margin_description'] = [
'#type' => 'item',
'#title' => $this
->t('Margin'),
'#markup' => $this
->t('<p>Enter one value per line, in the format <b>key|label</b> where <em>key</em> is the CSS class name (without the .), and <em>label</em> is the human readable name of the margin. <br /> <b>Note:</b> These options will be reflected on the range slider at the Layout Builder form, so make sure to sort them from lowest to greatest.</p>'),
];
$form['spacing']['margin_group'] = [
'#type' => 'container',
'#title' => $this
->t('Margin'),
'#title_display' => 'invisible',
'#tree' => FALSE,
'#attributes' => [
'class' => [
'bs-admin-d-lg-flex',
'bs-admin-group-form-item-lg-ml',
],
],
];
$form['spacing']['margin_group']['margin'] = [
'#type' => 'textarea',
'#default_value' => $config
->get('margin'),
'#title' => $this
->t('Margin (classes)'),
'#cols' => 60,
'#rows' => 5,
];
for ($i = 0; $i < 4; $i++) {
$form['spacing']['margin_group']['margin_' . $directions[$i]] = [
'#type' => 'textarea',
'#default_value' => $config
->get('margin_' . $directions[$i]),
'#title' => $this
->t('Margin @direction (classes)', [
'@direction' => $directions[$i],
]),
'#cols' => 60,
'#rows' => 5,
];
}
return $form;
}