setLayoutDefinitions() public method

public setLayoutDefinitions ( array $layoutDefinitions )
$layoutDefinitions array
Beispiel #1
0
 public function fieldcollectionUpdateAction()
 {
     try {
         $key = $this->getParam("key");
         if ($this->getParam("task") == "add") {
             // check for existing fieldcollection with same name with different lower/upper cases
             $list = new Object\Fieldcollection\Definition\Listing();
             $list = $list->load();
             foreach ($list as $item) {
                 if (strtolower($key) === strtolower($item->getKey())) {
                     throw new \Exception("FieldCollection with the same name already exists (lower/upper cases may be different)");
                 }
             }
         }
         $fc = new Object\Fieldcollection\Definition();
         $fc->setKey($key);
         if ($this->getParam("values")) {
             $values = \Zend_Json::decode($this->getParam("values"));
             $fc->setParentClass($values["parentClass"]);
         }
         if ($this->getParam("configuration")) {
             $configuration = \Zend_Json::decode($this->getParam("configuration"));
             $configuration["datatype"] = "layout";
             $configuration["fieldtype"] = "panel";
             $layout = Object\ClassDefinition\Service::generateLayoutTreeFromArray($configuration, true);
             $fc->setLayoutDefinitions($layout);
         }
         $fc->save();
         $this->_helper->json(["success" => true, "id" => $fc->getKey()]);
     } catch (\Exception $e) {
         Logger::error($e->getMessage());
         $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
     }
 }
Beispiel #2
0
 public function fieldcollectionUpdateAction()
 {
     try {
         $fc = new Object\Fieldcollection\Definition();
         $fc->setKey($this->getParam("key"));
         if ($this->getParam("values")) {
             $values = \Zend_Json::decode($this->getParam("values"));
             $fc->setParentClass($values["parentClass"]);
         }
         if ($this->getParam("configuration")) {
             $configuration = \Zend_Json::decode($this->getParam("configuration"));
             $configuration["datatype"] = "layout";
             $configuration["fieldtype"] = "panel";
             $layout = Object\ClassDefinition\Service::generateLayoutTreeFromArray($configuration, true);
             $fc->setLayoutDefinitions($layout);
         }
         $fc->save();
         $this->_helper->json(array("success" => true, "id" => $fc->getKey()));
     } catch (\Exception $e) {
         \Logger::error($e->getMessage());
         $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
     }
 }