Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResourceInterface.php

interface ResourceInterface

Specifies the publicly available methods of a resource plugin.

Hierarchy

  • interface \Drupal\Component\Plugin\PluginInspectionInterface
    • interface \Drupal\rest\Plugin\ResourceInterface extends \Drupal\Component\Plugin\PluginInspectionInterface

Expanded class hierarchy of ResourceInterface

All classes that implement ResourceInterface

See also

\Drupal\rest\Annotation\RestResource

\Drupal\rest\Plugin\Type\ResourcePluginManager

\Drupal\rest\Plugin\ResourceBase

Plugin API

Related topics

REST and Application Integration
Integrating third-party applications using REST and related operations.
2 files declare their use of ResourceInterface
RequestHandler.php in core/modules/rest/src/RequestHandler.php
ResourcePluginManager.php in core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
1 string reference to 'ResourceInterface'
rest.schema.yml in core/modules/rest/config/schema/rest.schema.yml
core/modules/rest/config/schema/rest.schema.yml

File

core/modules/rest/src/Plugin/ResourceInterface.php, line 17

Namespace

Drupal\rest\Plugin
View source
interface ResourceInterface extends PluginInspectionInterface {
    
    /**
     * Returns a collection of routes with URL path information for the resource.
     *
     * This method determines where a resource is reachable, what path
     * replacements are used, the required HTTP method for the operation etc.
     *
     * @return \Symfony\Component\Routing\RouteCollection
     *   A collection of routes that should be registered for this resource.
     */
    public function routes();
    
    /**
     * Provides an array of permissions suitable for .permissions.yml files.
     *
     * A resource plugin can define a set of user permissions that are used on the
     * routes for this resource or for other purposes.
     *
     * It is not required for a resource plugin to specify permissions: if they
     * have their own access control mechanism, they can use that, and return the
     * empty array.
     *
     * @return array
     *   The permission array.
     */
    public function permissions();
    
    /**
     * Returns the available HTTP request methods on this plugin.
     *
     * @return array
     *   The list of supported methods. Example: array('GET', 'POST', 'PATCH').
     */
    public function availableMethods();

}

Members

Title Sort descending Modifiers Object type Summary Overrides
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 5
PluginInspectionInterface::getPluginId public function Gets the plugin ID of the plugin instance. 2
ResourceInterface::availableMethods public function Returns the available HTTP request methods on this plugin. 1
ResourceInterface::permissions public function Provides an array of permissions suitable for .permissions.yml files. 1
ResourceInterface::routes public function Returns a collection of routes with URL path information for the resource. 1
RSS feed
Powered by Drupal