You are here

public function Articles__1_5::imageProcess in RESTful 7.2

Process callback, Remove Drupal specific items from the image array.

Parameters

array $value: The image array.

Return value

array A cleaned image array.

File

modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_5.php, line 106
Contains \Drupal\restful_example\Plugin\resource\node\article\v1\Articles__1_5.

Class

Articles__1_5
Class Articles__1_5 @package Drupal\restful\Plugin\resource

Namespace

Drupal\restful_example\Plugin\resource\node\article\v1

Code

public function imageProcess($value) {
  if (ResourceFieldBase::isArrayNumeric($value)) {
    $output = array();
    foreach ($value as $item) {
      $output[] = $this
        ->imageProcess($item);
    }
    return $output;
  }
  return array(
    'id' => $value['fid'],
    'self' => file_create_url($value['uri']),
    'filemime' => $value['filemime'],
    'filesize' => $value['filesize'],
    'width' => $value['width'],
    'height' => $value['height'],
    'styles' => $value['image_styles'],
  );
}