From cff7f652534b30e7bcdd963b8aee74e451217b9b Mon Sep 17 00:00:00 2001 From: Mike Ng Date: Mon, 5 Mar 2018 16:41:20 +0400 Subject: [PATCH] read video chapters from meta fields in video-editor --- .../Controller/Prod/ToolsController.php | 23 +++++++++++++++---- .../web/prod/actions/Tools/index.html.twig | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php index 0139be9586..18a2f8bfd6 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php @@ -40,10 +40,24 @@ class ToolsController extends Controller $metadatas = false; $record = null; $recordAccessibleSubdefs = array(); + $JSFields = []; if (count($records) == 1) { /** @var \record_adapter $record */ $record = $records->first(); + $databox = $record->getDatabox(); + + + foreach ($databox->get_meta_structure() as $meta) { + /** @var \databox_field $meta */ + $fields[] = $meta; + + /** @Ignore */ + $JSFields[$meta->get_id()] = [ + 'name' => $meta->get_name(), + '_value' => $record->getCaption([$meta->get_name()]), + ]; + } // fetch subdef list: $subdefs = $record->get_subdefs(); @@ -88,11 +102,12 @@ class ToolsController extends Controller $conf = $this->getConf(); return $this->render('prod/actions/Tools/index.html.twig', [ - 'records' => $records, - 'record' => $record, + 'records' => $records, + 'record' => $record, 'videoEditorConfig' => $conf->get(['video-editor']), - 'recordSubdefs' => $recordAccessibleSubdefs, - 'metadatas' => $metadatas, + 'recordSubdefs' => $recordAccessibleSubdefs, + 'metadatas' => $metadatas, + 'JSonFields' => json_encode($JSFields), ]); } diff --git a/templates/web/prod/actions/Tools/index.html.twig b/templates/web/prod/actions/Tools/index.html.twig index e380dc77d0..4315dfa990 100644 --- a/templates/web/prod/actions/Tools/index.html.twig +++ b/templates/web/prod/actions/Tools/index.html.twig @@ -365,6 +365,7 @@ processing: '{{ "processing" | trans }}', thumbnailTitle: '{{ 'thumbnail validation' | trans }}' }, + T_fields: {{ JSonFields|raw }}, videoEditorConfig: {% if videoEditorConfig is not null %}{{ videoEditorConfig|json_encode()|raw }}{% else %}{}{% endif %}, records: [