mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
PHRAS-1719 Add presets selection on subdef admin page
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Databox\SubdefGroup;
|
||||
use Alchemy\Phrasea\Media\MediaTypeFactory;
|
||||
use Assert\Assertion;
|
||||
use Alchemy\Phrasea\Media\MediaTypeFactory;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
@@ -185,15 +185,19 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
* @param string $groupname
|
||||
* @param string $name
|
||||
* @param string $class
|
||||
* @param string $mediatype
|
||||
* @param string $preset
|
||||
* @return databox_subdefsStructure
|
||||
*/
|
||||
public function add_subdef($groupname, $name, $class)
|
||||
public function add_subdef($groupname, $name, $class, $mediatype, $preset)
|
||||
{
|
||||
$dom_struct = $this->databox->get_dom_structure();
|
||||
|
||||
$subdef = $dom_struct->createElement('subdef');
|
||||
$subdef->setAttribute('class', $class);
|
||||
$subdef->setAttribute('name', mb_strtolower($name));
|
||||
$subdef->setAttribute('presets', $preset);
|
||||
$subdef->setAttribute('mediaType', $mediatype);
|
||||
|
||||
$dom_xp = $this->databox->get_xpath_structure();
|
||||
$query = '//record/subdefs/subdefgroup[@name="' . $groupname . '"]';
|
||||
@@ -234,19 +238,18 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $group
|
||||
* @param string $name
|
||||
* @param string $class
|
||||
* @param string $preset
|
||||
* @param boolean $downloadable
|
||||
* @param array $options
|
||||
* @param array $labels
|
||||
* @param bool $orderable
|
||||
* @return databox_subdefsStructure
|
||||
* @throws Exception
|
||||
*/
|
||||
public function set_subdef($group, $name, $class, $downloadable, $options, $labels, $orderable = true)
|
||||
public function set_subdef($group, $name, $class, $downloadable, $options, $labels, $preset = "Custom")
|
||||
{
|
||||
$dom_struct = $this->databox->get_dom_structure();
|
||||
|
||||
@@ -254,7 +257,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
$subdef->setAttribute('class', $class);
|
||||
$subdef->setAttribute('name', mb_strtolower($name));
|
||||
$subdef->setAttribute('downloadable', ($downloadable ? 'true' : 'false'));
|
||||
$subdef->setAttribute('orderable', ($orderable ? 'true' : 'false'));
|
||||
$subdef->setAttribute('presets', $preset);
|
||||
|
||||
foreach ($labels as $code => $label) {
|
||||
$child = $dom_struct->createElement('label');
|
||||
|
Reference in New Issue
Block a user