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

Breadcrumb

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

function ResourceBase::availableMethods

Overrides ResourceInterface::availableMethods

4 calls to ResourceBase::availableMethods()
EntityResource::availableMethods in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Returns the available HTTP request methods on this plugin.
EntityResource::availableMethods in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Returns the available HTTP request methods on this plugin.
ResourceBase::permissions in core/modules/rest/src/Plugin/ResourceBase.php
Implements ResourceInterface::permissions().
ResourceBase::routes in core/modules/rest/src/Plugin/ResourceBase.php
Returns a collection of routes with URL path information for the resource.
1 method overrides ResourceBase::availableMethods()
EntityResource::availableMethods in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Returns the available HTTP request methods on this plugin.

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal