mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
Refactor caption_field
This commit is contained in:
@@ -234,11 +234,20 @@ class Edit extends RecordHelper
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
foreach ($field->get_values() as $value)
|
||||||
|
{
|
||||||
|
$values[$value->getId()] = array(
|
||||||
|
'meta_id' => $value->getId(),
|
||||||
|
'value' => $value->getValue()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$_lst[$indice]['fields'][$meta_struct_id] = array(
|
$_lst[$indice]['fields'][$meta_struct_id] = array(
|
||||||
'dirty' => false,
|
'dirty' => false,
|
||||||
'meta_id' => $field->get_meta_id(),
|
// 'meta_id' => $field->get_meta_id(),
|
||||||
'meta_struct_id' => $meta_struct_id,
|
'meta_struct_id' => $meta_struct_id,
|
||||||
'value' => $field->get_value()
|
'values' => $values
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,15 +524,25 @@ class Edit extends RecordHelper
|
|||||||
$record->set_metadatas($rec['metadatas']);
|
$record->set_metadatas($rec['metadatas']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($write_edit_el instanceof \Acmedatabox_field)
|
/**
|
||||||
|
*todo : this should not work
|
||||||
|
*/
|
||||||
|
if ($write_edit_el instanceof \databox_field)
|
||||||
{
|
{
|
||||||
$fields = $record->get_caption()->get_fields(array($write_edit_el->get_name()));
|
$fields = $record->get_caption()->get_fields(array($write_edit_el->get_name()));
|
||||||
$field = array_pop($fields);
|
$field = array_pop($fields);
|
||||||
|
|
||||||
|
$meta_id = null;
|
||||||
|
|
||||||
|
if($field && !$field->is_multi())
|
||||||
|
{
|
||||||
|
$meta_id = array_pop($field->get_values())->getId();
|
||||||
|
}
|
||||||
|
|
||||||
$metas = array(
|
$metas = array(
|
||||||
array(
|
array(
|
||||||
'meta_struct_id' => $write_edit_el->get_id()
|
'meta_struct_id' => $write_edit_el->get_id()
|
||||||
, 'meta_id' => ($field ? $field->get_meta_id() : null)
|
, 'meta_id' => $meta_id
|
||||||
, 'value' => array($date_obj->format('Y-m-d h:i:s'))
|
, 'value' => array($date_obj->format('Y-m-d h:i:s'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user