public function deletePropertyAction()
{
if ($this->getRequest()->isPost()) {
$id = $this->getRequest()->getPost()->get('property');
$session = $this->getSession();
foreach ($session['document-type']['tabs'] as $tabId => $tab) {
if (empty($tab['properties'])) {
continue;
}
if (array_key_exists($id, $tab['properties'])) {
$documentTypeSession = $session['document-type'];
unset($documentTypeSession['tabs'][$tabId]['properties'][$id]);
$session->offsetSet('document-type', $documentTypeSession);
return $this->returnJson(array('success' => true, 'message' => 'This property has been deleted'));
}
}
}
return $this->returnJson(array('success' => false, 'message' => 'Error'));
}