1. 8.3.x core/modules/rest/src/Annotation/RestResource.php RestResource
  2. 8.0.x core/modules/rest/src/Annotation/RestResource.php RestResource
  3. 8.1.x core/modules/rest/src/Annotation/RestResource.php RestResource
  4. 8.2.x core/modules/rest/src/Annotation/RestResource.php RestResource
  5. 8.4.x core/modules/rest/src/Annotation/RestResource.php RestResource

Defines a REST resource annotation 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

3 classes are annotated with RestResource
DBLogResource in core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php
Provides a resource for database watchdog log entries.
EntityResource in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Represents entities as resources.
NoSerializationClassTestResource in core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php
Class used to test that serialization_class is optional.

File

core/modules/rest/src/Annotation/RestResource.php, line 23

Namespace

Drupal\rest\Annotation
View source
class RestResource extends Plugin {

  /**
   * The resource plugin ID.
   *
   * @var string
   */
  public $id;

  /**
   * The human-readable name of the resource plugin.
   *
   * @ingroup plugin_translatable
   *
   * @var \Drupal\Core\Annotation\Translation
   */
  public $label;

  /**
   * The serialization class to deserialize serialized data into.
   *
   * @var string (optional)
   */
  public $serialization_class;

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 2
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider 1
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 2
RestResource::$id public property The resource plugin ID.
RestResource::$label public property The human-readable name of the resource plugin.
RestResource::$serialization_class public property The serialization class to deserialize serialized data into.