本文整理汇总了PHP中Concrete\Core\Attribute\Key\Category::getByHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getByHandle方法的具体用法?PHP Category::getByHandle怎么用?PHP Category::getByHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Attribute\Key\Category
的用法示例。
在下文中一共展示了Category::getByHandle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(Batch $batch)
{
$sets = $batch->getObjectCollection('attribute_set');
if (!$sets) {
return;
}
foreach ($sets->getSets() as $set) {
$akc = Category::getByHandle($set->getCategory());
if (!$set->getPublisherValidator()->skipItem()) {
$pkg = null;
if ($set->getPackage()) {
$pkg = \Package::getByHandle($set->getPackage());
}
$setObject = $akc->addSet($set->getHandle(), $set->getName(), $pkg, intval($set->getIsLocked()));
} else {
$setObject = \Concrete\Core\Attribute\Set::getByHandle($set->getHandle());
}
if (is_object($setObject)) {
$attributes = $set->getAttributes();
foreach ($attributes as $handle) {
$ak = $akc->getAttributeKeyByHandle($handle);
if (is_object($ak)) {
$setObject->addKey($ak);
}
}
}
}
}
示例2: update
public function update($akID = null)
{
$this->edit($akID);
$key = CollectionKey::getByID($akID);
$category = Category::getByHandle('collection');
$this->executeUpdate($key, \URL::to('/dashboard/pages/attributes', 'view'));
}
示例3: installAttributeType
protected function installAttributeType($pkg)
{
$attributeHandle = 'related_pages';
\Loader::model('attribute/categories/collection');
AttributeType::add($attributeHandle, t('Related Pages'), \Package::getByHandle($this->pkgHandle));
AttributeKeyCategory::getByHandle('collection')->associateAttributeKeyType(AttributeType::getByHandle($attributeHandle));
}
示例4: install
public function install()
{
$pkg = parent::install();
\Loader::model('attribute/categories/collection');
$col = AttributeKeyCategory::getByHandle('collection');
$at = AttributeType::add('icon_selector', t('Icon Selector'), $pkg);
$col->associateAttributeKeyType($at);
}
示例5: view
public function view($ptID = false)
{
$this->setupPageType($ptID);
$this->requireAsset('core/app/editable-fields');
$this->set('pagetype', $this->pagetype);
$this->set('defaultPage', $this->defaultPage);
$category = AttributeKeyCategory::getByHandle('collection');
$this->set('category', $category);
}
示例6: getList
public function getList($akCategoryHandle = false)
{
$r = $this->entityManager->getRepository('\\Concrete\\Core\\Entity\\Attribute\\Type');
if ($akCategoryHandle == false) {
return $r->findAll();
} else {
$category = Category::getByHandle($akCategoryHandle);
return $category->getAttributeTypes();
}
}
示例7: on_start
public function on_start()
{
parent::on_start();
$this->set('category', AttributeKeyCategory::getByHandle('user'));
$otypes = AttributeType::getList('user');
$types = array();
foreach ($otypes as $at) {
$types[$at->getAttributeTypeID()] = $at->getAttributeTypeDisplayName();
}
$this->set('types', $types);
}
示例8: addAttributes
private function addAttributes($pkg)
{
\Loader::model('attribute/categories/collection');
$col = AttributeKeyCategory::getByHandle('collection');
$fileSelector = AttributeType::add('multifile_picker', t('Multiple File Picker'), $pkg);
$col->associateAttributeKeyType($fileSelector);
$userSelector = AttributeType::add('multiuser_picker', t('Multiple User Picker'), $pkg);
$col->associateAttributeKeyType($userSelector);
$pageSelector = AttributeType::add('multipage_picker', t('Multiple Page Picker'), $pkg);
$col->associateAttributeKeyType($pageSelector);
}
示例9: import
public function import(\SimpleXMLElement $sx)
{
if (isset($sx->attributecategories)) {
foreach ($sx->attributecategories->category as $akc) {
$pkg = static::getPackageObject($akc['package']);
$akx = \Concrete\Core\Attribute\Key\Category::getByHandle($akc['handle']);
if (!is_object($akx)) {
$akx = \Concrete\Core\Attribute\Key\Category::add((string) $akc['handle'], (string) $akc['allow-sets'], $pkg);
}
}
}
}
示例10: import
public function import(\SimpleXMLElement $sx)
{
if (isset($sx->attributekeys)) {
foreach ($sx->attributekeys->attributekey as $ak) {
$akc = \Concrete\Core\Attribute\Key\Category::getByHandle($ak['category']);
$controller = $akc->getController();
$attribute = $controller->getAttributeKeyByHandle((string) $ak['handle']);
if (!$attribute) {
$pkg = static::getPackageObject($ak['package']);
$type = Type::getByHandle((string) $ak['type']);
$key = $controller->import($type, $ak, $pkg);
}
}
}
}
示例11: installAttributeKeys
private function installAttributeKeys($pkg)
{
$dbTableDemoAT = AttributeType::getByHandle("db_table_demo");
if (!$dbTableDemoAT) {
$dbTableDemoAT = AttributeType::add("db_table_demo", "Database Table Demo", $pkg);
$cakc = AttributeKeyCategory::getByHandle('collection');
$cakc->associateAttributeKeyType($dbTableDemoAT);
$uakc = AttributeKeyCategory::getByHandle('user');
$uakc->associateAttributeKeyType($dbTableDemoAT);
$fakc = AttributeKeyCategory::getByHandle('file');
$fakc->associateAttributeKeyType($dbTableDemoAT);
}
$this->addPageAttributeKeys($pkg);
$this->addUserAttributeKeys($pkg);
$this->addFileAttributeKeys($pkg);
}
示例12: view
public function view()
{
$pk = PermissionKey::getByHandle('edit_page_properties');
$pk->setPermissionObject($this->page);
$assignment = $pk->getMyAssignment();
$allowed = $assignment->getAttributesAllowedArray();
$category = AttributeKeyCategory::getByHandle('collection');
$controller = $category->getController();
$sets = $controller->getSetManager()->getAttributeSets();
$leftovers = $controller->getSetManager()->getUnassignedAttributeKeys();
$selectedAttributes = $this->page->getSetCollectionAttributes();
$selectedAttributeIDs = array();
foreach ($selectedAttributes as $ak) {
$selectedAttributeIDs[] = $ak->getAttributeKeyID();
}
$data = array();
foreach ($sets as $set) {
$obj = new stdClass();
$obj->title = $set->getAttributeSetDisplayName();
$obj->attributes = array();
foreach ($set->getAttributeKeys() as $ak) {
if (in_array($ak->getAttributeKeyID(), $allowed)) {
$obj->attributes[] = $ak;
}
}
if (count($obj->attributes)) {
$data[] = $obj;
}
}
if (count($leftovers)) {
$obj = new stdClass();
$obj->title = t('Other');
$obj->attributes = array();
foreach ($leftovers as $ak) {
if (in_array($ak->getAttributeKeyID(), $allowed)) {
$obj->attributes[] = $ak;
}
}
if (count($obj->attributes)) {
$data[] = $obj;
}
}
$this->set('selectedAttributeIDs', $selectedAttributeIDs);
$this->set('assignment', $assignment);
$this->set('attributes', $data);
}
示例13: import
public function import(\SimpleXMLElement $sx)
{
if (isset($sx->attributesets)) {
foreach ($sx->attributesets->attributeset as $as) {
$set = \Concrete\Core\Attribute\Set::getByHandle((string) $as['handle']);
$akc = \Concrete\Core\Attribute\Key\Category::getByHandle($as['category']);
$controller = $akc->getController();
$manager = $controller->getSetManager();
if (!is_object($set)) {
$pkg = static::getPackageObject($as['package']);
$set = $manager->addSet((string) $as['handle'], (string) $as['name'], $pkg, $as['locked']);
}
foreach ($as->children() as $ask) {
$ak = $controller->getAttributeKeyByHandle((string) $ask['handle']);
if (is_object($ak)) {
$manager->addKey($set, $ak);
}
}
}
}
}
示例14: import
public function import(\SimpleXMLElement $sx)
{
if (isset($sx->attributetypes)) {
foreach ($sx->attributetypes->attributetype as $at) {
$pkg = static::getPackageObject($at['package']);
$name = (string) $at['name'];
if (!$name) {
$name = \Core::make('helper/text')->unhandle($at['handle']);
}
$type = Type::getByHandle($at['handle']);
if (!is_object($type)) {
$type = Type::add((string) $at['handle'], $name, $pkg);
}
if (isset($at->categories)) {
foreach ($at->categories->children() as $cat) {
$catobj = \Concrete\Core\Attribute\Key\Category::getByHandle((string) $cat['handle']);
$catobj->getController()->associateAttributeKeyType($type);
}
}
}
}
}
示例15: execute
public function execute(Batch $batch)
{
$types = $batch->getObjectCollection('attribute_key_category');
if (!$types) {
return;
}
foreach ($types->getCategories() as $type) {
if (!$type->getPublisherValidator()->skipItem()) {
$pkg = null;
if ($type->getPackage()) {
$pkg = \Package::getByHandle($type->getPackage());
}
$type = Type::add($type->getHandle(), $type->getName(), $pkg);
$categories = $type->getCategories();
foreach ($categories as $category) {
$co = Category::getByHandle($category);
if (is_object($co)) {
$co->associateAttributeKeyType($type);
}
}
}
}
}