From 36423a9b3925c633d7fb0cd5ea7d646dea2fb8f0 Mon Sep 17 00:00:00 2001 From: aina-esokia Date: Mon, 16 Jul 2018 16:29:27 +0400 Subject: [PATCH] default path when create a new subviews --- lib/classes/databox.php | 10 ++++++++++ lib/classes/databox/subdefsStructure.php | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/lib/classes/databox.php b/lib/classes/databox.php index 56a319f78f..1473ce7168 100644 --- a/lib/classes/databox.php +++ b/lib/classes/databox.php @@ -1473,6 +1473,16 @@ class databox extends base implements ThumbnailedElement ]; } + /** + * Return the default subdef path + * + * @return string + */ + public function getSubdefStorage(){ + + return p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'subdefs'])).$this->get_dbname()."/subdefs/"; + } + protected function retrieve_structure() { try { diff --git a/lib/classes/databox/subdefsStructure.php b/lib/classes/databox/subdefsStructure.php index 6e375a4cdc..b5823c12e1 100644 --- a/lib/classes/databox/subdefsStructure.php +++ b/lib/classes/databox/subdefsStructure.php @@ -202,6 +202,11 @@ class databox_subdefsStructure implements IteratorAggregate, Countable $mediaTypeElement->appendChild($dom_struct->createTextNode($mediatype)); $subdef->appendChild($mediaTypeElement); + $defaultPath = $this->databox->getSubdefStorage(); + $pathElement = $dom_struct->createElement('path'); + $pathElement->appendChild($dom_struct->createTextNode($defaultPath)); + $subdef->appendChild($pathElement); + $dom_xp = $this->databox->get_xpath_structure(); $query = '//record/subdefs/subdefgroup[@name="' . $groupname . '"]'; $groups = $dom_xp->query($query);