abstract class AbstractSettingObject in Fasttoggle 8.2
Abstract class for an object on which Fasttoggle can modify settings.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\fasttoggle\Plugin\SettingObject\AbstractSettingObject implements SettingObjectInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of AbstractSettingObject
1 file declares its use of AbstractSettingObject
- AbstractSettingGroup.php in src/
Plugin/ SettingGroup/ AbstractSettingGroup.php - Fasttoggle Object List of Values Setting
File
- src/
Plugin/ SettingObject/ AbstractSettingObject.php, line 17 - Abstract Fasttoggle Object
Namespace
Drupal\fasttoggle\Plugin\SettingObjectView source
abstract class AbstractSettingObject extends PluginBase implements SettingObjectInterface {
/**
* @var object $object
* The object being managed.
* */
protected $object;
/**
* Retrieve the object type that can be modified by this setting.
*
* @return string
* The machine name for the object type being modified by this setting.
*/
public function __get($name) {
// Simple member
if (isset($this->{$name})) {
return $this->{$name};
}
// Annotation
$definition = $this
->getPluginDefinition();
if (isset($definition[$name])) {
return $definition[$name];
}
// Specific getter function
$functionName = "get_{$name}";
if (is_callable([
$this,
$functionName,
])) {
return $this
->{$functionName}();
}
// Unmatched
$trace = debug_backtrace();
trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
return NULL;
}
/**
* Set an instance of the object.
*/
public function setObject($object) {
$this->object = $object;
}
/**
* Get the object instance.
*
* @return object
* The instance of the object, if any.
*/
public function get_object() {
return $this->object;
}
/**
* Object ID.
*
* @return integer
* The unique ID of this instance of the object.
*/
public abstract function get_id();
/**
* Object title.
*
* @return integer
* The title of the object for display.
*/
public abstract function get_title();
/**
* Save function. Update the entity in the database.
*
* @return bool
* Whether the object was successfully saved.
*/
public abstract function save();
/**
* Object subtype machine name.
*
* @return string
* A subtype (if any) of the object (eg node type).
*/
public function get_type() {
return '';
}
/**
* Access.
*
* @return bool
* Whether the user is permitted to modify settings on this object instance.
*/
public function mayEditEntity() {
return FALSE;
}
/**
* Get an array of sitewide setting form elements for this object type.
*
* @param $config
* The configuration storage.
*
* @return array
* Render array for the sitewide settings.
*/
public static function getSitewideSettingFormElements($config) {
return [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractSettingObject:: |
protected | property | The object being managed. | |
AbstractSettingObject:: |
public static | function |
Get an array of sitewide setting form elements for this object type. Overrides SettingObjectInterface:: |
2 |
AbstractSettingObject:: |
abstract public | function |
Object ID. Overrides SettingObjectInterface:: |
3 |
AbstractSettingObject:: |
public | function |
Get the object instance. Overrides SettingObjectInterface:: |
|
AbstractSettingObject:: |
abstract public | function |
Object title. Overrides SettingObjectInterface:: |
3 |
AbstractSettingObject:: |
public | function |
Object subtype machine name. Overrides SettingObjectInterface:: |
1 |
AbstractSettingObject:: |
public | function |
Access. Overrides SettingObjectInterface:: |
3 |
AbstractSettingObject:: |
abstract public | function |
Save function. Update the entity in the database. Overrides SettingObjectInterface:: |
3 |
AbstractSettingObject:: |
public | function |
Set an instance of the object. Overrides SettingObjectInterface:: |
1 |
AbstractSettingObject:: |
public | function | Retrieve the object type that can be modified by this setting. | 1 |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 92 |
SettingObjectInterface:: |
public | function | Matches an object? | 3 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |