class WidgetSettings in Maxlength 8
The WidgetManager service.
Hierarchy
- class \Drupal\maxlength\WidgetSettings implements WidgetSettingsInterface
Expanded class hierarchy of WidgetSettings
1 string reference to 'WidgetSettings'
1 service uses WidgetSettings
File
- src/
WidgetSettings.php, line 8
Namespace
Drupal\maxlengthView source
class WidgetSettings implements WidgetSettingsInterface {
/**
* {@inheritdoc}
*/
public function getAllowedSettingsForAll() {
$settings = array(
'string_textfield' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => FALSE,
'truncate_setting' => FALSE,
),
'string_textarea' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => FALSE,
'truncate_setting' => TRUE,
),
'text_textfield' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => FALSE,
'truncate_setting' => FALSE,
),
'text_textarea' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => FALSE,
'truncate_setting' => TRUE,
),
'text_textarea_with_summary' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => TRUE,
'truncate_setting' => TRUE,
),
'key_value_textarea' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => TRUE,
'truncate_setting' => TRUE,
),
'link_default' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => FALSE,
'truncate_setting' => FALSE,
),
'linkit' => array(
'maxlength_setting' => TRUE,
'summary_maxlength_setting' => FALSE,
'truncate_setting' => FALSE,
),
);
$additional_widget_settings = \Drupal::moduleHandler()
->invokeAll('maxlength_widget_settings') ?: [];
return $settings + $additional_widget_settings;
}
/**
* {@inheritdoc}
*
* @see \Drupal\maxlength\WidgetSettingsInterface::getAllowedSettings()
*/
public function getAllowedSettings($widget_plugin_id) {
$all_settings = $this
->getAllowedSettingsForAll();
if (!empty($all_settings[$widget_plugin_id])) {
return $all_settings[$widget_plugin_id];
}
return array();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WidgetSettings:: |
public | function |
Overrides WidgetSettingsInterface:: |
|
WidgetSettings:: |
public | function |
Returns all the settings which are allowed for all the widgets. Overrides WidgetSettingsInterface:: |