public function InsertFileWidgetUtility::settingsForm in Insert 8
Parameters
array $element:
array $settings:
Return value
array
See also
\Drupal\Core\Field\WidgetInterface::settingsForm()
1 call to InsertFileWidgetUtility::settingsForm()
- InsertImageWidgetUtility::settingsForm in src/
Utility/ InsertImageWidgetUtility.php - @inheritdoc
1 method overrides InsertFileWidgetUtility::settingsForm()
- InsertImageWidgetUtility::settingsForm in src/
Utility/ InsertImageWidgetUtility.php - @inheritdoc
File
- src/
Utility/ InsertFileWidgetUtility.php, line 45
Class
Namespace
Drupal\insert\UtilityCode
public function settingsForm($element, $settings) {
$stylesList = $this
->retrieveStyles();
$stylesList = $this
->stylesListToOptions($stylesList);
$element['insert_absolute'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Use absolute paths'),
'#default_value' => $settings['insert_absolute'],
'#description' => $this
->t('Includes the full URL prefix "@base_url" in all links and image tags.', [
'@base_url' => $GLOBALS['base_url'],
]),
'#weight' => 21,
];
$element['insert_styles_styles_heading'] = [
'#type' => 'markup',
'#markup' => $this
->t('Select which styles should be available for inserting images into text areas. If no styles are selected, the option to use a style is not displayed; If only one style is selected, that one is used automatically when inserting. If all styles are selected, new styles will be enabled by default.'),
'#weight' => 22,
];
$element['insert_styles'] = [
'#type' => 'table',
'#default_value' => !empty($settings['insert_styles']['<all>']) ? array_keys($stylesList) : $settings['insert_styles'],
'#element_validate' => [
[
get_called_class(),
'validateStyles',
],
],
'#weight' => 23,
'#tableselect' => TRUE,
'#header' => [
t('Select all'),
],
];
foreach ($stylesList as $key => $label) {
$element['insert_styles'][$key][$key] = [
'#type' => 'markup',
'#markup' => $label,
];
}
$element['insert_default'] = [
'#title' => $this
->t('Default insert style'),
'#type' => 'select',
'#options' => $stylesList,
'#default_value' => $settings['insert_default'],
'#description' => $this
->t('Select the default style which will be selected by default or used if no specific styles above are enabled.'),
'#weight' => 24,
];
return $element;
}