public function add($atHandle, $atName, $pkg = null) { $type = new AttributeType(); $type->setAttributeTypeName($atName); $type->setAttributeTypeHandle($atHandle); if ($pkg) { $type->setPackage($pkg); } $this->installLegacyDatabaseFile($type); $this->entityManager->persist($type); $this->entityManager->flush(); return $type; }
protected function executeAdd(Type $type, $successURL, $onComplete = null) { $entity = $this->getCategoryObject(); $category = $entity->getAttributeKeyCategory(); $validator = $type->getController()->getValidator(); $response = $validator->validateAddKeyRequest($category, $type, $this->request); if (!$response->isValid()) { $this->error = $response->getErrorObject(); } else { /* * @var $category \Concrete\Core\Attribute\Category\CategoryInterface */ $key = $category->addFromRequest($type, $this->request); $this->assignToSetFromRequest($key); if ($onComplete instanceof \Closure) { $onComplete(); } $this->flash('success', t('Attribute created successfully.')); $this->redirect($successURL); } }
public function import(AttributeType $type, \SimpleXMLElement $element, Package $package = null) { $key = $this->createAttributeKey(); $loader = $this->getImportLoader(); $loader->load($key, $element); $controller = $type->getController(); $settings = $controller->importKey($element); if (!is_object($settings)) { $settings = $controller->getAttributeKeySettings(); } return $this->add($type, $key, $settings, $package); }
public function getController() { $controller = $this->type->getController(); $controller->setAttributeKey($this); return $controller; }
public function validateAddKeyRequest(CategoryInterface $category, TypeEntity $type, Request $request) { return $this->validate($category, $type->getController(), $request); }
public function getAddAttributeTypeURL(Type $type) { $args = array($this->getDashboardPagePath(), $this->getDashboardPageAddAction()); $args = array_merge($args, $this->getDashboardPageParameters(), array($type->getAttributeTypeID())); return call_user_func_array(array('\\URL', 'to'), $args); }