mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Include caption metadatas in search type 2
This commit is contained in:
@@ -1420,6 +1420,9 @@ class V1Controller extends Controller
|
|||||||
'results.stories.records.status'
|
'results.stories.records.status'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$includes[] = 'results.stories.caption_metadata';
|
||||||
|
}
|
||||||
|
|
||||||
$includes = array_merge($includes, [
|
$includes = array_merge($includes, [
|
||||||
'results.records.subdefs',
|
'results.records.subdefs',
|
||||||
|
@@ -18,7 +18,7 @@ class StoryTransformer extends TransformerAbstract
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = ['thumbnail', 'metadatas', 'records'];
|
protected $availableIncludes = ['thumbnail', 'metadatas', 'records', 'caption_metadatas'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
@@ -77,6 +77,22 @@ class StoryTransformer extends TransformerAbstract
|
|||||||
return $this->collection($storyView->getChildren(), $this->recordTransformer);
|
return $this->collection($storyView->getChildren(), $this->recordTransformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeCaptionMetadatas(StoryView $storyView)
|
||||||
|
{
|
||||||
|
return $this->collection($storyView->getStory()->get_caption()->get_fields(), $this->getCaptionRecordTransformer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCaptionRecordTransformer()
|
||||||
|
{
|
||||||
|
return function (\caption_field $captionField) {
|
||||||
|
return [
|
||||||
|
'meta_structure_id' => $captionField->get_meta_struct_id(),
|
||||||
|
'name' => $captionField->get_name(),
|
||||||
|
'value' => $captionField->get_serialized_values(';')
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Closure
|
* @return \Closure
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user