class RestResource

Same name in this branch
  1. 10 core/modules/rest/src/Annotation/RestResource.php \Drupal\rest\Annotation\RestResource
Same name in other branches
  1. 9 core/modules/rest/src/Annotation/RestResource.php \Drupal\rest\Annotation\RestResource
  2. 8.9.x core/modules/rest/src/Annotation/RestResource.php \Drupal\rest\Annotation\RestResource
  3. 11.x core/modules/rest/src/Attribute/RestResource.php \Drupal\rest\Attribute\RestResource
  4. 11.x core/modules/rest/src/Annotation/RestResource.php \Drupal\rest\Annotation\RestResource

Defines a REST resource attribute object.

Plugin Namespace: Plugin\rest\resource

For a working example, see \Drupal\dblog\Plugin\rest\resource\DbLogResource

Hierarchy

Expanded class hierarchy of RestResource

See also

\Drupal\rest\Plugin\Type\ResourcePluginManager

\Drupal\rest\Plugin\ResourceBase

\Drupal\rest\Plugin\ResourceInterface

Plugin API

Related topics

6 files declare their use of RestResource
DbLogResource.php in core/modules/dblog/src/Plugin/rest/resource/DbLogResource.php
EntityResource.php in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
FileUploadResource.php in core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
NoSerializationClassTestResource.php in core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php
ResourcePluginManager.php in core/modules/rest/src/Plugin/Type/ResourcePluginManager.php

... See full list

File

core/modules/rest/src/Attribute/RestResource.php, line 24

Namespace

Drupal\rest\Attribute
View source
class RestResource extends Plugin {
    
    /**
     * Constructs a RestResource attribute.
     *
     * @param string $id
     *   The REST resource plugin ID.
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup $label
     *   The human-readable name of the REST resource plugin.
     * @param string|null $serialization_class
     *   (optional) The serialization class to deserialize serialized data into.
     * @param class-string|null $deriver
     *   (optional) The deriver class for the rest resource.
     * @param array $uri_paths
     *   (optional) The URI paths that this REST resource plugin provides.
     *   - key: The link relation type plugin ID.
     *   - value: The URL template.
     *
     * @see \Symfony\Component\Serializer\SerializerInterface
     * @see core/core.link_relation_types.yml
     */
    public function __construct(string $id, TranslatableMarkup $label, ?string $serialization_class = NULL, ?string $deriver = NULL, array $uri_paths = []) {
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AttributeBase::$class protected property The class used for this attribute class.
AttributeBase::$provider protected property The provider of the attribute class.
AttributeBase::get public function Overrides AttributeInterface::get 6
AttributeBase::getClass public function Overrides AttributeInterface::getClass 1
AttributeBase::getId public function Overrides AttributeInterface::getId
AttributeBase::getProvider public function Overrides AttributeInterface::getProvider
AttributeBase::setClass public function Overrides AttributeInterface::setClass 1
AttributeBase::setProvider public function Overrides AttributeInterface::setProvider
RestResource::__construct public function Constructs a RestResource attribute. Overrides Plugin::__construct

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.