You are here

protected function FormatterJsonApi::needsIncluding in RESTful 7.2

Checks if a resource field needs to be embedded in the response.

Parameters

ResourceFieldResourceInterface $resource_field: The embedded resource field.

array $parents: The parents of this embedded resource.

Return value

bool TRUE if the field needs including. FALSE otherwise.

1 call to FormatterJsonApi::needsIncluding()
FormatterJsonApi::embedField in src/Plugin/formatter/FormatterJsonApi.php
Embeds the final contents of a field.

File

src/Plugin/formatter/FormatterJsonApi.php, line 527
Contains \Drupal\restful\Plugin\formatter\FormatterJsonApi.

Class

FormatterJsonApi
Class FormatterJsonApi @package Drupal\restful\Plugin\formatter

Namespace

Drupal\restful\Plugin\formatter

Code

protected function needsIncluding(ResourceFieldResourceInterface $resource_field, $parents) {
  $input = $this
    ->getRequest()
    ->getParsedInput();
  $includes = empty($input['include']) ? array() : explode(',', $input['include']);
  return in_array($this
    ->buildIncludePath($parents, $resource_field
    ->getPublicName()), $includes);
}