当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::getByHandle方法代码示例

本文整理汇总了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);
                 }
             }
         }
     }
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:28,代码来源:CreateAttributeSetsRoutine.php

示例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'));
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:attributes.php

示例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));
 }
开发者ID:YumpDigital,项目名称:concrete5-package-related-pages,代码行数:7,代码来源:controller.php

示例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);
 }
开发者ID:Bloodb0ne,项目名称:Concrete5_DevRepo,代码行数:8,代码来源:controller.php

示例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);
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:9,代码来源:attributes.php

示例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();
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:10,代码来源:TypeFactory.php

示例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);
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:11,代码来源:attributes.php

示例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);
 }
开发者ID:Bloodb0ne,项目名称:Concrete5_DevRepo,代码行数:11,代码来源:controller.php

示例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);
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:12,代码来源:ImportAttributeCategoriesRoutine.php

示例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);
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:15,代码来源:ImportAttributesRoutine.php

示例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);
 }
开发者ID:herent,项目名称:c5_tutorials_database_attribute,代码行数:16,代码来源:controller.php

示例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);
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:46,代码来源:attributes.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:21,代码来源:ImportAttributeSetsRoutine.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:22,代码来源:ImportAttributeTypesRoutine.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:23,代码来源:CreateAttributeTypesRoutine.php


注:本文中的Concrete\Core\Attribute\Key\Category::getByHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。