Drupal 8  8.0.2
ResourceBase Class Reference
Inheritance diagram for ResourceBase:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger)
 
 permissions ()
 
 routes ()
 
 availableMethods ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Protected Member Functions

 requestMethods ()
 
 getBaseRoute ($canonical_path, $method)
 

Protected Attributes

 $serializerFormats = array()
 
 $logger
 

Detailed Description

Common base class for resource plugins.

See Also
Plugin API

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
array  $serializer_formats,
LoggerInterface  $logger 
)

Constructs a Drupal object.

Parameters
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin_id for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
array$serializer_formatsThe available serialization formats.
\Psr\Log\LoggerInterface$loggerA logger instance.

References Drupal\logger().

Here is the call graph for this function:

Member Function Documentation

availableMethods ( )

{Returns the available HTTP request methods on this plugin.

Returns
array The list of supported methods. Example: array('GET', 'POST', 'PATCH').
}

Implements ResourceInterface.

References ResourceBase\requestMethods().

Referenced by ResourceBase\permissions(), and ResourceBase\routes().

Here is the call graph for this function:

Here is the caller graph for this function:

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

getBaseRoute (   $canonical_path,
  $method 
)
protected

Setups the base route for all HTTP methods.

Parameters
string$canonical_pathThe canonical path for the resource.
string$methodThe HTTP method to be used for the route.
Returns
The created base route.

Referenced by ResourceBase\routes().

Here is the caller graph for this function:

permissions ( )

Implements ResourceInterface::permissions().

Every plugin operation method gets its own user permission. Example: "restful delete entity:node" with the title "Access DELETE on Node resource".

Implements ResourceInterface.

References ResourceBase\availableMethods(), PluginInspectionInterface\getPluginDefinition(), and t().

Here is the call graph for this function:

requestMethods ( )
protected

Provides predefined HTTP request methods.

Plugins can override this method to provide additional custom request methods.

Returns
array The list of allowed HTTP request method strings.

Referenced by ResourceBase\availableMethods().

Here is the caller graph for this function:

routes ( )

{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.

Returns
A collection of routes that should be registered for this resource.
}

Implements ResourceInterface.

References ResourceBase\availableMethods(), ResourceBase\getBaseRoute(), and PluginInspectionInterface\getPluginDefinition().

Here is the call graph for this function:


The documentation for this class was generated from the following file: