You are here

interface SettingObjectInterface in Fasttoggle 8.2

An interface for objects that have toggleable attributes.

The object class should have a Plugin annotation with the following attributes:

  • title: Heading for settings forms.
  • description: Help text for settings forms.
  • machine_name: A name for the object type - will be used to build

classnames, selectors, form elements and so on. Lowercase letters and underscores.

Abstract class provides a private $object member and default implementations for:

  • setObject: Save a passed object into the $object protected member.
  • getSubType: Subtype of the object (eg node type) being empty (no subtype)

Hierarchy

Expanded class hierarchy of SettingObjectInterface

All classes that implement SettingObjectInterface

2 files declare their use of SettingObjectInterface
AbstractSettingObject.php in src/Plugin/SettingObject/AbstractSettingObject.php
Abstract Fasttoggle Object
SettingGroupInterface.php in src/Plugin/SettingGroup/SettingGroupInterface.php
Provides Drupal\fasttoggle\SettingGroupInterface.

File

src/Plugin/SettingObject/SettingObjectInterface.php, line 25
Provides Drupal\fasttoggle\ObjectInterface.

Namespace

Drupal\fasttoggle\Plugin\SettingObject
View source
interface SettingObjectInterface {

  /**
   * Set an instance of the object.
   */
  public function setObject($object);

  /**
   * Object ID.
   *
   * @return integer
   *   The unique ID of this instance of the object.
   */
  public function get_id();

  /**
   * Get the node / user / ...
   *
   * @return object
   *   The object being modified.
   */
  public function get_object();

  /**
   * Object title.
   *
   * @return integer
   *   The title of the object for display.
   */
  public function get_title();

  /**
   * Save function. Update the entity in the database.
   *
   * @return bool
   *   Whether the object was successfully saved.
   */
  public function save();

  /**
   * Object subtype machine name.
   *
   * @return string
   *   A subtype (if any) of the object (eg node type).
   */
  public function get_type();

  /**
   * 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 mayEditEntity();

  /**
   * Matches an object?
   *
   * @param $object
   *   The object to be checked.
   *
   * @return boolean
   *   Whether this class handles that object.
   */
  public function objectMatches($object);

  /**
   * 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);

}

Members

Namesort descending Modifiers Type Description Overrides
SettingObjectInterface::getSitewideSettingFormElements public static function Get an array of sitewide setting form elements for this object type. 2
SettingObjectInterface::get_id public function Object ID. 1
SettingObjectInterface::get_object public function Get the node / user / ... 1
SettingObjectInterface::get_title public function Object title. 1
SettingObjectInterface::get_type public function Object subtype machine name. 1
SettingObjectInterface::mayEditEntity public function Write access control check for the object as a whole. 1
SettingObjectInterface::objectMatches public function Matches an object? 3
SettingObjectInterface::save public function Save function. Update the entity in the database. 1
SettingObjectInterface::setObject public function Set an instance of the object. 1