You are here

interface ResourceFieldInterface in RESTful 7.2

Hierarchy

Expanded class hierarchy of ResourceFieldInterface

All classes that implement ResourceFieldInterface

12 files declare their use of ResourceFieldInterface
CacheDecoratedDataProvider.php in src/Plugin/resource/DataProvider/CacheDecoratedDataProvider.php
Contains \Drupal\restful\Plugin\resource\DataProvider\CacheDecoratedDataProvider.
DataProvider.php in src/Plugin/resource/DataProvider/DataProvider.php
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProvider.
DataProviderDecorator.php in src/Plugin/resource/DataProvider/DataProviderDecorator.php
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderDecorator.
DataProviderEntity.php in src/Plugin/resource/DataProvider/DataProviderEntity.php
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.
DataProviderInterface.php in src/Plugin/resource/DataProvider/DataProviderInterface.php
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderInterface.

... See full list

File

src/Plugin/resource/Field/ResourceFieldInterface.php, line 17
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldInterface.

Namespace

Drupal\restful\Plugin\resource\Field
View source
interface ResourceFieldInterface {

  /**
   * @return mixed
   */
  public function getPublicName();

  /**
   * @param mixed $public_name
   */
  public function setPublicName($public_name);

  /**
   * @return array
   */
  public function getAccessCallbacks();

  /**
   * @param array $access_callbacks
   */
  public function setAccessCallbacks($access_callbacks);

  /**
   * @return string
   */
  public function getProperty();

  /**
   * @param string $property
   */
  public function setProperty($property);

  /**
   * @return mixed
   */
  public function getCallback();

  /**
   * @param mixed $callback
   */
  public function setCallback($callback);

  /**
   * @return array
   */
  public function getProcessCallbacks();

  /**
   * @param array $process_callbacks
   */
  public function setProcessCallbacks($process_callbacks);

  /**
   * @return array
   */
  public function getResource();

  /**
   * @param array $resource
   */
  public function setResource($resource);

  /**
   * @return array
   */
  public function getMethods();

  /**
   * @param array $methods
   *
   * @throws ServerConfigurationException
   */
  public function setMethods($methods);

  /**
   * Checks if the current field is computed.
   *
   * @return bool
   *   TRUE if the field is computed.
   */
  public function isComputed();

  /**
   * Helper method to determine if an array is numeric.
   *
   * @param array $input
   *   The input array.
   *
   * @return boolean
   *   TRUE if the array is numeric, false otherwise.
   */
  public static function isArrayNumeric(array $input);

  /**
   * Factory.
   *
   * @param array $field
   *   Contains the field values.
   * @param RequestInterface $request
   *   The request.
   *
   * @return ResourceFieldInterface
   *   The created field
   *
   * @throws ServerConfigurationException
   */
  public static function create(array $field, RequestInterface $request = NULL);

  /**
   * Gets the value for the field given a data source.
   *
   * @param DataInterpreterInterface $interpreter
   *   The data source object. Interacts with the data storage.
   *
   * @return mixed
   *   The value for the public field.
   *
   * @throws IncompatibleFieldDefinitionException
   */
  public function value(DataInterpreterInterface $interpreter);

  /**
   * Check access on property by the defined access callbacks.
   *
   * @param string $op
   *   The operation that access should be checked for. Can be "view" or "edit".
   *   Defaults to "edit".
   * @param DataInterpreterInterface $interpreter
   *   The data source representing the entity.
   *
   * @return bool
   *   TRUE if the current user has access to set the property, FALSE otherwise.
   *   The default implementation assumes that if no callback has explicitly
   *   denied access, we grant the user permission.
   */
  public function access($op, DataInterpreterInterface $interpreter);

  /**
   * Gets the ID of the resource field.
   *
   * @return string
   *   The ID.
   */
  public function id();

  /**
   * Adds the default values to the definitions array.
   */
  public function addDefaults();

  /**
   * Add metadata to the field.
   *
   * This is a general purpose metadata storage for the field to store other
   * things that are not specifically the field value.
   *
   * You can pass in a namespaced $key using a : as a delimiter. Namespaces will
   * result in nested arrays. That means that addMetadata('foo:bar:baz', 'oof')
   * will result in metadata['foo']['bar']['baz'] = 'oof'.
   *
   * @param string $key
   *   The metadata item identifier.
   * @param mixed $value
   *   The metadata value.
   */
  public function addMetadata($key, $value);

  /**
   * Add metadata to the field.
   *
   * This is a general purpose metadata storage for the field to store other
   * things that are not specifically the field value.
   *
   * @param string $key
   *   The metadata item identifier.
   *
   * @return mixed
   *   The metadata value.
   */
  public function getMetadata($key);

  /**
   * Gets the value for the field given a data source.
   *
   * @param mixed $value
   *   The value for the field.
   * @param DataInterpreterInterface $interpreter
   *   The data source object. Interacts with the data storage.
   *
   * @throws IncompatibleFieldDefinitionException
   */
  public function set($value, DataInterpreterInterface $interpreter);

  /**
   * Executes the process callbacks.
   *
   * @param mixed $value
   *   The initial value.
   *
   * @return mixed
   *   The processed value.
   */
  public function executeProcessCallbacks($value);

  /**
   * Fetches the embedded identifier(s) for the current resource field, if any.
   *
   * @param DataInterpreterInterface $interpreter
   *   The data interpreter to get the compound ID.
   *
   * @return string|string[]
   *   An identifier or an array of identifiers for cardinality > 1. NULL if
   *   there is no identifier to be found.
   */
  public function compoundDocumentId(DataInterpreterInterface $interpreter);

  /**
   * Gets the value of a field and applies all process callbacks to it.
   *
   * @param DataInterpreterInterface $interpreter
   *   The data interpreter.
   *
   * @return mixed
   *   The value to render.
   */
  public function render(DataInterpreterInterface $interpreter);

  /**
   * Gets the cardinality of the wrapped field.
   *
   * @return int
   *   The number of potentially returned fields. Reuses field cardinality
   *   constants.
   */
  public function getCardinality();

  /**
   * Set the cardinality.
   *
   * @param int $cardinality
   *   The new cardinality.
   */
  public function setCardinality($cardinality);

  /**
   * Get the request in the data provider.
   *
   * @return RequestInterface
   *   The request.
   */
  public function getRequest();

  /**
   * Set the request.
   *
   * @param RequestInterface $request
   *   The request.
   */
  public function setRequest(RequestInterface $request);

  /**
   * Gets the original field definition as declared in Resource::publicFields().
   *
   * @return array
   *   The field definition.
   */
  public function getDefinition();

  /**
   * Gets the public field info object.
   *
   * @return PublicFieldInfoInterface
   *   The public field info object.
   */
  public function getPublicFieldInfo();

  /**
   * Gets the public field info object.
   *
   * @param PublicFieldInfoInterface $public_field_info
   *   The public field info object.
   */
  public function setPublicFieldInfo(PublicFieldInfoInterface $public_field_info);

}

Members

Namesort descending Modifiers Type Description Overrides
ResourceFieldInterface::access public function Check access on property by the defined access callbacks. 3
ResourceFieldInterface::addDefaults public function Adds the default values to the definitions array. 3
ResourceFieldInterface::addMetadata public function Add metadata to the field. 3
ResourceFieldInterface::compoundDocumentId public function Fetches the embedded identifier(s) for the current resource field, if any. 3
ResourceFieldInterface::create public static function Factory. 3
ResourceFieldInterface::executeProcessCallbacks public function Executes the process callbacks. 3
ResourceFieldInterface::getAccessCallbacks public function 3
ResourceFieldInterface::getCallback public function 3
ResourceFieldInterface::getCardinality public function Gets the cardinality of the wrapped field. 3
ResourceFieldInterface::getDefinition public function Gets the original field definition as declared in Resource::publicFields(). 3
ResourceFieldInterface::getMetadata public function Add metadata to the field. 3
ResourceFieldInterface::getMethods public function 3
ResourceFieldInterface::getProcessCallbacks public function 3
ResourceFieldInterface::getProperty public function 3
ResourceFieldInterface::getPublicFieldInfo public function Gets the public field info object. 3
ResourceFieldInterface::getPublicName public function 3
ResourceFieldInterface::getRequest public function Get the request in the data provider. 3
ResourceFieldInterface::getResource public function 3
ResourceFieldInterface::id public function Gets the ID of the resource field. 3
ResourceFieldInterface::isArrayNumeric public static function Helper method to determine if an array is numeric. 3
ResourceFieldInterface::isComputed public function Checks if the current field is computed. 3
ResourceFieldInterface::render public function Gets the value of a field and applies all process callbacks to it. 3
ResourceFieldInterface::set public function Gets the value for the field given a data source. 3
ResourceFieldInterface::setAccessCallbacks public function 3
ResourceFieldInterface::setCallback public function 3
ResourceFieldInterface::setCardinality public function Set the cardinality. 3
ResourceFieldInterface::setMethods public function 3
ResourceFieldInterface::setProcessCallbacks public function 3
ResourceFieldInterface::setProperty public function 3
ResourceFieldInterface::setPublicFieldInfo public function Gets the public field info object. 3
ResourceFieldInterface::setPublicName public function 3
ResourceFieldInterface::setRequest public function Set the request. 3
ResourceFieldInterface::setResource public function 3
ResourceFieldInterface::value public function Gets the value for the field given a data source. 3