Skip to content

Instantly share code, notes, and snippets.

@bartoszrychlicki
Created September 5, 2012 19:07
Show Gist options
  • Save bartoszrychlicki/3642736 to your computer and use it in GitHub Desktop.
Save bartoszrychlicki/3642736 to your computer and use it in GitHub Desktop.
<<<<<<< HEAD
// Leeave the lines before, soon we need functionality of editing tables!
$val = $request->request->get($form->getName().'[contentFields]['.$index.'][value]',null,true);
if ($contentField->getType() === \Br\StgCcBundle\Entity\ContentField::TYPE_TABLE) {
$val = serialize(json_decode($val));
=======
$val = $request->request->get($form->getName().'[contentFields]['.$index.'][value][value]',null,true);
if ($contentField->getType() === \Br\StgCcBundle\Entity\ContentField::TYPE_TABLE) {
$val = json_decode($val);
//manual bind to overcome $form->bind() limitations
$contentField->getValue()->setValue($val);
>>>>>>> 159f53e1e4629cc11b631b0a79daea77edef4579
}
if ($contentField->getType() === \Br\StgCcBundle\Entity\ContentField::TYPE_IMAGE) {
if ($request->get('remove_image') !== null && in_array($contentField->getTemplateIndex(), (array)$request->get('remove_image'))) {
$contentField->getValue()->removeUpload();
$contentField->getValue()->setValue(null);
}
}
if ($contentField->getType() === \Br\StgCcBundle\Entity\ContentField::TYPE_TABLE) {
<<<<<<< HEAD
if ($request->get('remove_table') !== null && in_array($contentField->getId(), (array)$request->get('remove_table'))) {
$contentField->removeUpload();
$val = null;
} else {
//$unsets[] = $index;
=======
if ($request->get('remove_table') !== null && in_array($contentField->getTemplateIndex(), (array)$request->get('remove_table'))) {
//method below is not yet implemented
//$contentField->getValue()->removeUpload();
//manual bind to overcome $form->bind() limitations
$contentField->getValue()->setValue(array(array()));
>>>>>>> 159f53e1e4629cc11b631b0a79daea77edef4579
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment