You are here

public function Resource::controllersInfo in RESTful 7.2

Gets the controllers.

Return value

array An structured configuration array. Contains the regular expression for the path as the key and an array of key values as its value. That array of key values contains the HTTP method as the key and the name of the public method to execute as the value. If an access callback is needed one can be provided by turning the value into an array with the keys: 'callback' and 'access callback'.

Overrides ResourceInterface::controllersInfo

See also

getControllers()

2 calls to Resource::controllersInfo()
Resource::getControllers in src/Plugin/resource/Resource.php
Gets the controllers for this resource.
TestArticles__1_3::controllersInfo in tests/modules/restful_test/src/Plugin/resource/node/test_article/v1/TestArticles__1_3.php
Gets the controllers.
6 methods override Resource::controllersInfo()
AccessToken__1_0::controllersInfo in modules/restful_token_auth/src/Plugin/resource/AccessToken__1_0.php
Gets the controllers.
Discovery::controllersInfo in src/Plugin/resource/Discovery.php
@inheritDoc
LoginCookie__1_0::controllersInfo in src/Plugin/resource/LoginCookie__1_0.php
Overrides \RestfulBase::controllersInfo().
RefreshToken__1_0::controllersInfo in modules/restful_token_auth/src/Plugin/resource/RefreshToken__1_0.php
Overrides \RestfulBase::controllersInfo().
TestArticles__1_3::controllersInfo in tests/modules/restful_test/src/Plugin/resource/node/test_article/v1/TestArticles__1_3.php
Gets the controllers.

... See full list

File

src/Plugin/resource/Resource.php, line 307
Contains \Drupal\restful\Plugin\resource\Resource.

Class

Resource

Namespace

Drupal\restful\Plugin\resource

Code

public function controllersInfo() {
  return array(
    '' => array(
      // GET returns a list of entities.
      RequestInterface::METHOD_GET => 'index',
      RequestInterface::METHOD_HEAD => 'index',
      // POST.
      RequestInterface::METHOD_POST => 'create',
      RequestInterface::METHOD_OPTIONS => 'discover',
    ),
    // We don't know what the ID looks like, assume that everything is the ID.
    '^.*$' => array(
      RequestInterface::METHOD_GET => 'view',
      RequestInterface::METHOD_HEAD => 'view',
      RequestInterface::METHOD_PUT => 'replace',
      RequestInterface::METHOD_PATCH => 'update',
      RequestInterface::METHOD_DELETE => 'remove',
      RequestInterface::METHOD_OPTIONS => 'discover',
    ),
  );
}