You are here

public function Resource::getControllers in RESTful 7.2

Gets the controllers for this resource.

@code{ array( '^.*$' => array(RequestInterface::METHOD_GET => array( 'callback' => 'view', 'access callback' => array($this, 'viewAccess'), )), ); }

@todo: Populate the entity controllers so that they have the entity access checks in here.

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 an array with the callback information as the value.

The callback can be anything that ResourceManager::executeCallback accepts or a string indicating a public method in the resource plugin class.

Overrides ResourceInterface::getControllers

1 call to Resource::getControllers()
Resource::preflight in src/Plugin/resource/Resource.php
Adds the Allowed-Origin headers.

File

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

Class

Resource

Namespace

Drupal\restful\Plugin\resource

Code

public function getControllers() {
  $controllers = array();
  foreach ($this
    ->controllersInfo() as $path => $method_info) {
    $controllers[$path] = array();
    foreach ($method_info as $http_method => $controller_info) {
      $controllers[$path][$http_method] = $controller_info;
      if (!is_array($controller_info)) {
        $controllers[$path][$http_method] = array(
          'callback' => $controller_info,
        );
      }
    }
  }
  return $controllers;
}