interface SettingInterface in Fasttoggle 8.2
Interface for settings. Plugin strings are used for quick filtering without the need to instantiate the class.
A plugin definition should have:
- id: Unique ID for the plugin in the settings namespace
- object: The object type modified by this setting (matches
\Drupal\fasttoggle\Plugin\SettingObject)
- name: A short, human readable name for this setting (will be
included in sentences).
- description: Help text for site and group setting forms.
- group: The group of settings within forms.
- weight: The ordering of the setting within its group.
- default_access: Whether to allow fast toggling of this setting
by default.
Plus either:
- labels: An array of FASTTOGGLE_LABEL_ACTION and FASTTOGGLE_LABEL_STATUS,
each itself containing an array of key -> value pairs of states for the setting. Keys are values to store in the setting and values are textual descriptions, to be passed to t().
OR for a single setting that can have multiple instances (roles):
- label_template: Like labels above except that the content may
contain %s once. %s will be replaced with the human readable name of the setting value (eg: role name).
- description template: A description that may also have the %s
placeholder.
Hierarchy
- interface \Drupal\fasttoggle\Plugin\SettingObject\SettingObjectInterface
- interface \Drupal\fasttoggle\Plugin\SettingGroup\SettingGroupInterface
- interface \Drupal\fasttoggle\Plugin\Setting\SettingInterface
- interface \Drupal\fasttoggle\Plugin\SettingGroup\SettingGroupInterface
Expanded class hierarchy of SettingInterface
All classes that implement SettingInterface
File
- src/
Plugin/ Setting/ SettingInterface.php, line 42 - Provides Drupal\fasttoggle\SettingInterface.
Namespace
Drupal\fasttoggle\Plugin\SettingView source
interface SettingInterface extends SettingGroupInterface {
/**
* Retrieve the current value of the setting.
*
* @param string $instance
* The name of the particular attribute being toggled.
*
* @return string
* The current key matching getHumanReadableValueList / getValueList.
*/
function get_value($instance);
/**
* Modify the setting.
*
* @param string instance
* The instance (role name / value index ... ) to modify.
* @param mixed newValue
* The new value to save
*
* @return \Drupal\fasttoggle\Plugin\SettingObject\SettingObjectInterface
* The related object, so you can chain a call to its the save method.
*/
function set_value($instance, $newValue);
/**
* Move to the next setting value.
*
* @return \Drupal\fasttoggle\Plugin\SettingObject\SettingObjectInterface
* The related object, so you can chain a call to its the save method.
*/
public function nextValue($instance);
/**
* Move to the previous setting value and save it.
*
* (Allows some widget to implement forward and back buttons if desired).
*
* @return \Drupal\fasttoggle\Plugin\SettingObject\SettingObjectInterface
* The related object, so you can chain a call to its the save method.
*/
public function previousValue($instance);
/**
* Get a plain text list of human readable labels for the setting, in the
* order used.
*
* This allows human readable labels to be sorted in non-alphabetical order.
* Note that the widget object may use this or an attribute of the value
* itself to render an icon, an ajax link or something else.
*
* @return array
* An array of human readable values, in the order they will appear when
* stepping through them.
*/
public function getHumanReadableValueList();
/**
* Get a list of actual values for the setting, in the order used.
*
* Keys should match those returned for the list of human readable labels.
*
* @return array
* An array of the actual values for the field, with keys matching those
* returned by getHumanReadableValueList.
*/
public function getValueList();
/**
* Return the sitewide form element for this setting.
*
* @return array
* Form element for this setting.
*/
public function settingForm($config, $prefix);
/**
* Write access control check for the object as a whole.
*
* @return bool
* Whether the user is permitted to modify settings on this object instance.
*/
public function mayEdit();
/**
* Write access control check for the particular setting.
*
* @return bool
* Whether the user is permitted to modify this particular setting.
*/
public function mayEditSetting();
/**
* Return whether this setting matches the provided field definition.
*
* @param $definition
* The field definition for which a match is being sought.
*
* @return boolean
* Whether this plugin handles the definition.
*/
public static function matches($definition);
/**
* Get the markup we modify.
*
* @param \Drupal\Core\Field\FieldItemList $items
* The items to be displayed.
* @param array $config
* The configuration used to generate the original link.
*/
public function formatter(FieldItemList $items, $config);
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SettingGroupInterface:: |
public static | function |
Get an array of sitewide setting form elements for this object type. Overrides SettingObjectInterface:: |
|
SettingGroupInterface:: |
public static | function | Return whether this setting group includes the provided field definition. | 4 |
SettingGroupInterface:: |
public | function | Write access control check for the group of settings. | 5 |
SettingInterface:: |
public | function | Get the markup we modify. | |
SettingInterface:: |
public | function | Get a plain text list of human readable labels for the setting, in the order used. | |
SettingInterface:: |
public | function | Get a list of actual values for the setting, in the order used. | |
SettingInterface:: |
function | Retrieve the current value of the setting. | ||
SettingInterface:: |
public static | function | Return whether this setting matches the provided field definition. | 9 |
SettingInterface:: |
public | function | Write access control check for the object as a whole. | |
SettingInterface:: |
public | function | Write access control check for the particular setting. | |
SettingInterface:: |
public | function | Move to the next setting value. | |
SettingInterface:: |
public | function | Move to the previous setting value and save it. | |
SettingInterface:: |
public | function | Return the sitewide form element for this setting. | |
SettingInterface:: |
function | Modify the setting. | ||
SettingObjectInterface:: |
public | function | Object ID. | 1 |
SettingObjectInterface:: |
public | function | Get the node / user / ... | 1 |
SettingObjectInterface:: |
public | function | Object title. | 1 |
SettingObjectInterface:: |
public | function | Object subtype machine name. | 1 |
SettingObjectInterface:: |
public | function | Write access control check for the object as a whole. | 1 |
SettingObjectInterface:: |
public | function | Matches an object? | 3 |
SettingObjectInterface:: |
public | function | Save function. Update the entity in the database. | 1 |
SettingObjectInterface:: |
public | function | Set an instance of the object. | 1 |