mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 21:43:18 +00:00
PHRAS-1766 Add orderable checkbox for each subdef - Remove order option on groups
This commit is contained in:
@@ -220,36 +220,19 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SubdefGroup[] $groups
|
||||
*/
|
||||
public function updateSubdefGroups($groups)
|
||||
{
|
||||
Assertion::allIsInstanceOf($groups, SubdefGroup::class);
|
||||
|
||||
$dom_xp = $this->databox->get_xpath_structure();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
$nodes = $dom_xp->query('//record/subdefs/subdefgroup[@name="' . $group->getName() . '"]');
|
||||
|
||||
/** @var DOMElement $node */
|
||||
foreach ($nodes as $node) {
|
||||
$node->setAttribute('document_orderable', ($group->isDocumentOrderable() ? 'true' : 'false'));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $group
|
||||
* @param string $name
|
||||
* @param string $class
|
||||
* @param string $preset
|
||||
* @param boolean $downloadable
|
||||
* @param array $options
|
||||
* @param array $labels
|
||||
* @param boolean $orderable
|
||||
* @param string $preset
|
||||
* @return databox_subdefsStructure
|
||||
* @throws Exception
|
||||
*/
|
||||
public function set_subdef($group, $name, $class, $downloadable, $options, $labels, $preset = "Custom")
|
||||
public function set_subdef($group, $name, $class, $downloadable, $options, $labels, $orderable = true, $preset = "Custom")
|
||||
{
|
||||
$dom_struct = $this->databox->get_dom_structure();
|
||||
|
||||
@@ -257,6 +240,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) {
|
||||
|
Reference in New Issue
Block a user