You are here

class ResourceFieldKeyValue in RESTful 7.2

Hierarchy

Expanded class hierarchy of ResourceFieldKeyValue

File

src/Plugin/resource/Field/ResourceFieldKeyValue.php, line 13
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldKeyValue.

Namespace

Drupal\restful\Plugin\resource\Field
View source
class ResourceFieldKeyValue extends ResourceField implements ResourceFieldInterface {

  /**
   * {@inheritdoc}
   */
  public static function create(array $field, RequestInterface $request = NULL) {
    $request = $request ?: restful()
      ->getRequest();
    $resource_field = new static($field, $request);
    $resource_field
      ->addDefaults();
    return $resource_field;
  }

  /**
   * {@inheritdoc}
   */
  public function value(DataInterpreterInterface $interpreter) {
    if ($value = parent::value($interpreter)) {
      return $value;
    }
    return $interpreter
      ->getWrapper()
      ->get($this
      ->getProperty());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ResourceField::access public function Check access on property by the defined access callbacks. Overrides ResourceFieldInterface::access
ResourceField::addDefaults public function Adds the default values to the definitions array. Overrides ResourceFieldInterface::addDefaults
ResourceField::compoundDocumentId public function Fetches the embedded identifier(s) for the current resource field, if any. Overrides ResourceFieldInterface::compoundDocumentId 1
ResourceField::fieldClassName public static function Get the class name to use based on the field definition.
ResourceField::getCardinality public function Gets the cardinality of the wrapped field. Overrides ResourceFieldInterface::getCardinality
ResourceField::render public function Gets the value of a field and applies all process callbacks to it. Overrides ResourceFieldInterface::render
ResourceField::set public function Gets the value for the field given a data source. Overrides ResourceFieldInterface::set
ResourceField::setCardinality public function Set the cardinality. Overrides ResourceFieldInterface::setCardinality
ResourceField::__construct public function Constructor. 1
ResourceFieldBase::$accessCallbacks protected property An array of callbacks to determine if user has access to the property. Note that this callback is on top of the access provided by entity API, and is used for convenience, where for example write operation on a property should be denied only on…
ResourceFieldBase::$callback protected property A callable callback to get a computed value. The wrapped entity is passed as argument. Defaults To FALSE. The callback function receive as first argument the entity.
ResourceFieldBase::$cardinality protected property Holds the field cardinality.
ResourceFieldBase::$definition protected property The field definition array.
ResourceFieldBase::$metadata protected property A generic array storage.
ResourceFieldBase::$methods protected property The HTTP methods where this field applies.
ResourceFieldBase::$processCallbacks protected property An array of callbacks to perform on the returned value, or an array with the object and method.
ResourceFieldBase::$property protected property The entity property (e.g. "title", "nid").
ResourceFieldBase::$publicFieldInfo protected property Information about the field.
ResourceFieldBase::$publicName protected property Contains the public field name.
ResourceFieldBase::$request protected property The request object to be used.
ResourceFieldBase::$resource protected property This property can be assigned only to an entity reference field. Array of restful resources keyed by the target bundle. For example, if the field is referencing a node entity, with "Article" and "Page" bundles, we are able to map…
ResourceFieldBase::ACCESS_ALLOW constant Return this value from public field access callbacks to allow access.
ResourceFieldBase::ACCESS_DENY constant Return this value from public field access callbacks to deny access.
ResourceFieldBase::ACCESS_IGNORE constant Return this value from public field access callbacks to not affect access.
ResourceFieldBase::addMetadata public function Add metadata to the field. Overrides ResourceFieldInterface::addMetadata
ResourceFieldBase::autoDiscovery public function Basic auto discovery information.
ResourceFieldBase::emptyDiscoveryInfo public static function Returns the basic discovery information for a given field.
ResourceFieldBase::executeProcessCallbacks public function Executes the process callbacks. Overrides ResourceFieldInterface::executeProcessCallbacks
ResourceFieldBase::getAccessCallbacks public function Overrides ResourceFieldInterface::getAccessCallbacks
ResourceFieldBase::getCallback public function Overrides ResourceFieldInterface::getCallback
ResourceFieldBase::getDefinition public function Gets the original field definition as declared in Resource::publicFields(). Overrides ResourceFieldInterface::getDefinition
ResourceFieldBase::getMetadata public function Add metadata to the field. Overrides ResourceFieldInterface::getMetadata
ResourceFieldBase::getMethods public function Overrides ResourceFieldInterface::getMethods
ResourceFieldBase::getProcessCallbacks public function Overrides ResourceFieldInterface::getProcessCallbacks
ResourceFieldBase::getProperty public function Overrides ResourceFieldInterface::getProperty
ResourceFieldBase::getPublicFieldInfo public function Gets the public field info object. Overrides ResourceFieldInterface::getPublicFieldInfo
ResourceFieldBase::getPublicName public function Overrides ResourceFieldInterface::getPublicName
ResourceFieldBase::getRequest public function Get the request in the data provider. Overrides ResourceFieldInterface::getRequest
ResourceFieldBase::getResource public function Overrides ResourceFieldInterface::getResource
ResourceFieldBase::id public function Gets the ID of the resource field. Overrides ResourceFieldInterface::id
ResourceFieldBase::internalMetadataElement protected function Returns the last array element from the nested namespace array.
ResourceFieldBase::isArrayNumeric final public static function Helper method to determine if an array is numeric. Overrides ResourceFieldInterface::isArrayNumeric
ResourceFieldBase::isComputed public function Checks if the current field is computed. Overrides ResourceFieldInterface::isComputed
ResourceFieldBase::setAccessCallbacks public function Overrides ResourceFieldInterface::setAccessCallbacks
ResourceFieldBase::setCallback public function Overrides ResourceFieldInterface::setCallback
ResourceFieldBase::setMethods public function Overrides ResourceFieldInterface::setMethods
ResourceFieldBase::setProcessCallbacks public function Overrides ResourceFieldInterface::setProcessCallbacks
ResourceFieldBase::setProperty public function Overrides ResourceFieldInterface::setProperty
ResourceFieldBase::setPublicFieldInfo public function Gets the public field info object. Overrides ResourceFieldInterface::setPublicFieldInfo
ResourceFieldBase::setPublicName public function Overrides ResourceFieldInterface::setPublicName
ResourceFieldBase::setRequest public function Set the request. Overrides ResourceFieldInterface::setRequest
ResourceFieldBase::setResource public function Overrides ResourceFieldInterface::setResource
ResourceFieldKeyValue::create public static function Factory. Overrides ResourceField::create
ResourceFieldKeyValue::value public function Gets the value for the field given a data source. Overrides ResourceField::value