public function getAttributeSets() { return \Concrete\Core\Attribute\Set::getByAttributeKey($this); }
protected function assignToSetFromRequest(AttributeKeyInterface $key) { $request = $this->request; $entity = $this->getCategoryObject(); $category = $entity->getAttributeKeyCategory(); if ($category->getSetManager()->allowAttributeSets()) { $set = Set::getByID($request->request->get('asID')); $setKeys = Set::getByAttributeKey($key); if (in_array($set, $setKeys)) { return; } if ($category->getSetManager()->allowAttributeSets() == StandardSetManager::ASET_ALLOW_SINGLE || !is_object($set)) { $query = $this->entityManager->createQuery('delete from \\Concrete\\Core\\Entity\\Attribute\\SetKey sk where sk.attribute_key = :attribute_key'); $query->setParameter('attribute_key', $key); $query->execute(); } if (is_object($set)) { $this->entityManager->refresh($set); // Refresh display order just in case. $displayOrder = 0; foreach ($set->getAttributeKeyCollection() as $setKey) { $setKey->setDisplayOrder($displayOrder); $this->entityManager->persist($setKey); ++$displayOrder; } $setKey = new SetKey(); $setKey->setAttributeKey($key); $setKey->setAttributeSet($set); $setKey->setDisplayOrder($displayOrder); $this->entityManager->persist($setKey); } } $this->entityManager->flush(); }
echo t('Add Attributes to Set'); ?> </legend> <?php $cat = AttributeKeyCategory::getByID($set->getAttributeSetKeyCategoryID()); $cat = $cat->getAttributeKeyCategory(); $list = $cat->getList(); $unassigned = $cat->getSetManager()->getUnassignedAttributeKeys(); if (count($list) > 0) { ?> <div class="form-group"> <?php foreach ($list as $key) { $keySets = \Concrete\Core\Attribute\Set::getByAttributeKey($key); $disabled = ''; if (!$key->inAttributeSet($set) && count($keySets)) { $disabled = array('disabled' => 'disabled'); } ?> <div class="checkbox"> <label> <?php echo $form->checkbox('akID[]', $key->getAttributeKeyID(), $key->inAttributeSet($set), $disabled); ?> <span><?php echo $key->getAttributeKeyDisplayName(); ?> </span> <span class="help-inline"><?php