public function headingEditAction() { $field = Engine_Api::_()->fields()->getField($this->_getParam('field_id'), $this->_fieldType); // Create form $this->view->form = $form = new Fields_Form_Admin_Heading(); $form->submit->setLabel('Edit Heading'); // Get sync notice $linkCount = count(Engine_Api::_()->fields()->getFieldsMaps($this->_fieldType)->getRowsMatching('child_id', $field->field_id)); if ($linkCount >= 2) { $form->addNotice($this->view->translate(array('This question is synced. Changes you make here will be applied in %1$s other place.', 'This question is synced. Changes you make here will be applied in %1$s other places.', $linkCount - 1), $this->view->locale()->toNumber($linkCount - 1))); } // Check method/data if (!$this->getRequest()->isPost()) { $form->populate($field->toArray()); return; } if (!$form->isValid($this->getRequest()->getPost())) { return; } // Process Engine_Api::_()->fields()->editField($this->_fieldType, $field, $form->getValues()); $this->view->status = true; $this->view->field = $field->toArray(); $this->view->form = null; // Re-render all maps that have this field as a parent or child $maps = array_merge(Engine_Api::_()->fields()->getFieldsMaps($this->_fieldType)->getRowsMatching('field_id', $field->field_id), Engine_Api::_()->fields()->getFieldsMaps($this->_fieldType)->getRowsMatching('child_id', $field->field_id)); $html = array(); foreach ($maps as $map) { $html[$map->getKey()] = $this->view->adminFieldMeta($map); } $this->view->htmlArr = $html; }
public function headingEditAction() { $field = Engine_Api::_()->fields()->getField($this->_getParam('field_id'), $this->_fieldType); // Create form $this->view->form = $form = new Fields_Form_Admin_Heading(); $form->submit->setLabel('Edit Heading'); // Check method/data if (!$this->getRequest()->isPost()) { $form->populate($field->toArray()); return; } if (!$form->isValid($this->getRequest()->getPost())) { return; } // Process Engine_Api::_()->fields()->editField($this->_fieldType, $field, $form->getValues()); $this->view->status = true; $this->view->field = $field->toArray(); $this->view->form = null; // Re-render all maps that have this field as a parent or child $maps = array_merge(Engine_Api::_()->fields()->getFieldsMaps($this->_fieldType)->getRowsMatching('field_id', $field->field_id), Engine_Api::_()->fields()->getFieldsMaps($this->_fieldType)->getRowsMatching('child_id', $field->field_id)); $html = array(); foreach ($maps as $map) { $html[$map->getKey()] = $this->view->adminFieldMeta($map); } $this->view->htmlArr = $html; }