function EntityResource::availableMethods

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

Overrides ResourceBase::availableMethods

1 method overrides EntityResource::availableMethods()
ContactMessageResource::availableMethods in core/modules/contact/src/Plugin/rest/resource/ContactMessageResource.php
Returns the available HTTP request methods on this plugin.

File

core/modules/rest/src/Plugin/rest/resource/EntityResource.php, line 409

Class

EntityResource
Represents entities as resources.

Namespace

Drupal\rest\Plugin\rest\resource

Code

public function availableMethods() {
    $methods = parent::availableMethods();
    if ($this->isConfigEntityResource()) {
        // Currently only GET is supported for Config Entities.
        // @todo Remove when supported https://www.drupal.org/node/2300677
        $unsupported_methods = [
            'POST',
            'PUT',
            'DELETE',
            'PATCH',
        ];
        $methods = array_diff($methods, $unsupported_methods);
    }
    return $methods;
}

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