function ResourceTypeBuildEvent::disableField

Disables the given field on the resource type to be built.

Parameters

\Drupal\jsonapi\ResourceType\ResourceTypeField $field: The field for which to set a public name.

File

core/modules/jsonapi/src/ResourceType/ResourceTypeBuildEvent.php, line 145

Class

ResourceTypeBuildEvent
An event used to configure the construction of a JSON:API resource type.

Namespace

Drupal\jsonapi\ResourceType

Code

public function disableField(ResourceTypeField $field) {
  foreach ($this->fields as $index => $value) {
    if ($field === $value) {
      $this->fields[$index] = $value->disabled();
      return;
    }
  }
}

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