/** * {@inheritdoc} */ public function format() { $attributes = $this->instance->getAttributes(); $volumes = $this->instance->allVolumes(); foreach ($volumes as $index => $volume) { $attributes["volumes"][$index] = $volume->volumeToArray(); } return json_encode($attributes); }