PHP-Code:
'objekt_galerie' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_qfOM_objekte']['objekt_galerie'],
'inputType' => 'fileTree',
'eval' => array(
'mandatory'=>true,
'multiple' => true,
'files'=>true,
'fieldType'=>'checkbox',
'filesOnly'=>true,
'orderField'=>'orderSRC',
'isGallery'=>true
),
'exclude' => true,
'sql' => "blob NULL",
),
'orderSRC' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['orderSRC'],
'sql' => "blob NULL"
),
Klappt super
und dazu noch im Modul den OrderCase nicht vergessen damit das Feld auch greift. Cheers!
PHP-Code:
// Add the image
$images[$objSubfiles->path] = array
(
'id' => $objSubfiles->id,
'uuid' => $objSubfiles->uuid,
'name' => $objFile->basename,
'singleSRC' => $objSubfiles->path,
'alt' => $arrMeta['title'],
'imageUrl' => $arrMeta['link'],
'caption' => $arrMeta['caption']
);
if ($this->orderSRC != '')
{
$tmp = deserialize($this->orderSRC);
if (!empty($tmp) && is_array($tmp))
{
// Remove all values
$arrOrder = array_map(function(){}, array_flip($tmp));
// Move the matching elements to their position in $arrOrder
foreach ($images as $k=>$v)
{
if (array_key_exists($v['uuid'], $arrOrder))
{
$arrOrder[$v['uuid']] = $v;
unset($images[$k]);
}
}
// Append the left-over images at the end
if (!empty($images))
{
$arrOrder = array_merge($arrOrder, array_values($images));
}
// Remove empty (unreplaced) entries
$images = array_values(array_filter($arrOrder));
unset($arrOrder);
}
}
$images = array_values($images);
Lesezeichen