protected static function FormatterJsonApi::retrieveIncludedItem in RESTful 7.2
Retrieves an item from the included pool of items.
Parameters
string $type: The resource type.
string $id: The resource identifier.
array $included: All the available included elements.
Return value
array The JSON API element.
1 call to FormatterJsonApi::retrieveIncludedItem()
- FormatterJsonApi::restructureItem in src/
Plugin/ formatter/ FormatterJsonApi.php - Take a JSON API item and makes it hierarchical object, like simple JSON.
File
- src/
Plugin/ formatter/ FormatterJsonApi.php, line 727 - Contains \Drupal\restful\Plugin\formatter\FormatterJsonApi.
Class
- FormatterJsonApi
- Class FormatterJsonApi @package Drupal\restful\Plugin\formatter
Namespace
Drupal\restful\Plugin\formatterCode
protected static function retrieveIncludedItem($type, $id, array $included) {
foreach ($included as $item) {
if (!empty($item['type']) && $item['type'] == $type && !empty($item['id']) && $item['id'] == $id) {
return $item;
}
}
return NULL;
}