function ResourceBase::availableMethods

Same name in other branches
  1. 9 core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::availableMethods()
  2. 8.9.x core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::availableMethods()
  3. 11.x core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::availableMethods()

Overrides ResourceInterface::availableMethods

3 calls to ResourceBase::availableMethods()
EntityResource::availableMethods in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
ResourceBase::permissions in core/modules/rest/src/Plugin/ResourceBase.php
Implements ResourceInterface::permissions().
ResourceBase::routes in core/modules/rest/src/Plugin/ResourceBase.php
1 method overrides ResourceBase::availableMethods()
EntityResource::availableMethods in core/modules/rest/src/Plugin/rest/resource/EntityResource.php

File

core/modules/rest/src/Plugin/ResourceBase.php, line 148

Class

ResourceBase
Common base class for resource plugins.

Namespace

Drupal\rest\Plugin

Code

public function availableMethods() {
    $methods = $this->requestMethods();
    $available = [];
    foreach ($methods as $method) {
        // Only expose methods where the HTTP request method exists on the plugin.
        if (method_exists($this, strtolower($method))) {
            $available[] = $method;
        }
    }
    return $available;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.