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


PHP Type::getByHandle方法代码示例

本文整理汇总了PHP中Concrete\Core\Attribute\Type::getByHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getByHandle方法的具体用法?PHP Type::getByHandle怎么用?PHP Type::getByHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Concrete\Core\Attribute\Type的用法示例。


在下文中一共展示了Type::getByHandle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getByHandle

 public static function getByHandle($akHandle)
 {
     $ak = CacheLocal::getEntry('file_attribute_key_by_handle', $akHandle);
     if (is_object($ak)) {
         return $ak;
     } else {
         if ($ak == -1) {
             return false;
         }
     }
     $ak = -1;
     $db = Loader::db();
     $q = "SELECT ak.akID FROM AttributeKeys ak INNER JOIN AttributeKeyCategories akc ON ak.akCategoryID = akc.akCategoryID  WHERE ak.akHandle = ? AND akc.akCategoryHandle = 'file'";
     $akID = $db->GetOne($q, array($akHandle));
     if ($akID > 0) {
         $ak = self::getByID($akID);
     } else {
         // else we check to see if it's listed in the initial registry
         $ia = FileTypeList::getImporterAttribute($akHandle);
         if (is_object($ia)) {
             // we create this attribute and return it.
             $at = AttributeType::getByHandle($ia->akType);
             $args = array('akHandle' => $akHandle, 'akName' => $ia->akName, 'akIsSearchable' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => $ia->akIsEditable);
             $ak = static::add($at, $args);
         }
     }
     CacheLocal::set('file_attribute_key_by_handle', $akHandle, $ak);
     if ($ak === -1) {
         return false;
     }
     return $ak;
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:32,代码来源:FileKey.php

示例2: 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

示例3: add

 public function add($type, $key, $settings = null, $pkg = null)
 {
     if (is_string($type)) {
         $type = \Concrete\Core\Attribute\Type::getByHandle($type);
     }
     // Legacy array support for $key
     $asID = false;
     if (is_array($key)) {
         $handle = $key['akHandle'];
         $name = $key['akName'];
         if (isset($key['asID'])) {
             $asID = $key['asID'];
         }
         $key = $this->createAttributeKey();
         $key->setAttributeKeyHandle($handle);
         $key->setAttributeKeyName($name);
     }
     // Legacy support for third parameter which used to be package
     if ($settings instanceof Package || $settings instanceof \Concrete\Core\Package\Package) {
         $pkg = $settings;
         unset($settings);
     }
     if (!$settings) {
         $settings = $type->getController()->getAttributeKeySettings();
     }
     $key->setAttributeType($type);
     $this->entityManager->persist($key);
     $this->entityManager->flush();
     $settings->setAttributeKey($key);
     $key->setAttributeKeySettings($settings);
     $this->entityManager->persist($settings);
     $this->entityManager->flush();
     if (is_object($pkg)) {
         $key->setPackage($pkg);
     }
     // Modify the category's search indexer.
     $indexer = $this->getSearchIndexer();
     if (is_object($indexer)) {
         $indexer->updateRepositoryColumns($this, $key);
     }
     $this->entityManager->persist($key);
     $this->entityManager->flush();
     /* legacy support, attribute set */
     if ($asID) {
         $manager = $this->getSetManager();
         $factory = new SetFactory($this->entityManager);
         $set = $factory->getByID($asID);
         if (is_object($set)) {
             $manager->addKey($set, $key);
         }
     }
     return $key;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:53,代码来源:AbstractCategory.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installAttributeCategoryAndObject();
     AttributeType::add('boolean', 'Boolean');
     AttributeType::add('textarea', 'Textarea');
     AttributeType::add('text', 'text');
     foreach ($this->keys as $akHandle => $args) {
         $args['akHandle'] = $akHandle;
         $type = AttributeType::getByHandle($args['type']);
         $this->keys[] = call_user_func_array(array($this->getAttributeKeyClass(), 'add'), array($type, $args));
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:13,代码来源:AttributeTestCase.php

示例5: 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

示例6: 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

示例7: install

 public function install()
 {
     $pkg = parent::install();
     //Add dashboard page
     $sp = SinglePage::add('/dashboard/open_graph_tags_lite', $pkg);
     if (is_object($sp)) {
         $sp->update(array('cName' => t('Open Graph Tags Lite'), 'cDescription' => t('Auto insert Open Graph Tags (OGP) into HEAD tag')));
     }
     $sp = SinglePage::add('/dashboard/open_graph_tags_lite/settings', $pkg);
     if (is_object($sp)) {
         $sp->update(array('cName' => t('Open Graph Tags Settings'), 'cDescription' => ''));
     }
     //Add og:image attribute
     $cak = CollectionAttributeKey::getByHandle('og_image');
     if (!is_object($cak)) {
         $at = AttributeType::getByHandle('image_file');
         CollectionAttributeKey::add($at, array('akHandle' => 'og_image', 'akName' => t('og:image')));
     }
 }
开发者ID:JohntheFish,项目名称:c5-open-graph-tags-lite,代码行数:19,代码来源:controller.php

示例8: 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

示例9: import

 public static function import(\SimpleXMLElement $ak)
 {
     $type = AttributeType::getByHandle($ak['type']);
     $pkg = false;
     if ($ak['package']) {
         $pkg = Package::getByHandle($ak['package']);
     }
     $akn = static::add($type, array('akHandle' => $ak['handle'], 'akName' => $ak['name'], 'akIsSearchableIndexed' => $ak['indexed'], 'akIsSearchable' => $ak['searchable'], 'uakProfileDisplay' => $ak['profile-displayed'], 'uakProfileEdit' => $ak['profile-editable'], 'uakProfileEditRequired' => $ak['profile-required'], 'uakRegisterEdit' => $ak['register-editable'], 'uakRegisterEditRequired' => $ak['register-required'], 'uakMemberListDisplay' => $ak['member-list-displayed']), $pkg);
     $akn->getController()->importKey($ak);
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:10,代码来源:UserKey.php

示例10: install

    public function install()
    {
        $pkg = parent::install();
        // Dashboard Page
        $sp = SinglePage::add('/dashboard/forums', $pkg);
        if (is_object($sp)) {
            $sp->update(array('cName' => t('Forums'), 'cDescription' => t('Forums Dashboard')));
        }
        // Add Sidebar block set
        BlockTypeSet::add('forums', 'Forums', $pkg);
        // Add forum moderator user group
        $forumGroup = Group::getByName('Forum Moderators');
        if (!is_object($authorGroup)) {
            Group::add('Forum Moderators', t('Forum Moderators, delete, edit, approve'));
        }
        // install blocks
        BlockType::installBlockTypeFromPackage('webli_forum_post', $pkg);
        BlockType::installBlockTypeFromPackage('webli_forum_list', $pkg);
        BlockType::installBlockTypeFromPackage('webli_forum_search', $pkg);
        BlockType::installBlockTypeFromPackage('webli_forum_archive', $pkg);
        BlockType::installBlockTypeFromPackage('webli_forum_tags', $pkg);
        // Add Collection Attribute Set
        $akCat = AttributeKeyCategory::getByHandle('collection');
        $akCat->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
        $akCatSet = $akCat->addSet('forums', t('Forums'), $pkg);
        // Add Collection Attributes
        $attribute = CollectionAttributeKey::getByHandle('forum_post');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('textarea');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_post', 'akName' => t('Forum Post'), 'akIsSearchableIndexed' => true, 'akTextareaDisplayMode' => 'rich_text'), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('forum_category');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('boolean');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_category', 'akName' => t('Forum Category')), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('forum_email');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('text');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_email', 'akName' => t('Forum Email Address'), 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('forum_name');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('text');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_name', 'akName' => t('Forum Name'), 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('forum_pin');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('boolean');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_pin', 'akName' => t('Pin Forum Post')), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('forum_post_approved');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('boolean');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_post_approved', 'akName' => t('Forum Post Approved')), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('tags');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('select');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'tags', 'akName' => t('Tags'), 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($akCatSet);
        }
        $attribute = CollectionAttributeKey::getByHandle('forum_image');
        if (!is_object($attribute)) {
            $att = AttributeType::getByHandle('image_file');
            // add to attribute set
            CollectionAttributeKey::add($att, array('akHandle' => 'forum_image', 'akName' => t('Forum Image')), $pkg)->setAttributeSet($akCatSet);
            $addAttribute = CollectionAttributeKey::getByHandle('forum_image');
        }
        // Add top level Forums Page
        $forumPage = \Page::getByPath('/forums');
        if (!is_object($forumPage) || $forumPage->cID == null) {
            $parentPage = \Page::getByID(1);
            $pageType = \PageType::getByHandle('right_sidebar');
            $template = \PageTemplate::getByHandle('right_sidebar');
            $forumsPage = $parentPage->add($pageType, array('cName' => t('Forums'), 'cDescription' => t('Top Level Forums Page'), 'cHandle ' => 'forums'), $template);
            //Add forum_category page attribute
            $forumsPage->setAttribute('forum_category', 1);
        }
        // Add top Forum Search Results Page
        $forumSearchPage = \Page::getByPath('/forum-search');
        if (!is_object($forumSearchPage) || $forumSearch->cID == null) {
            $parentPage = \Page::getByID(1);
            $pageType = \PageType::getByHandle('right_sidebar');
            $template = \PageTemplate::getByHandle('right_sidebar');
            $forumSearchPage = $parentPage->add($pageType, array('cName' => t('Forum Search'), 'cDescription' => t('Forum Search Page'), 'cHandle ' => 'forum-search'), $template);
            $forumSearchPage->setAttribute('exclude_nav', 1);
        }
        // Add Forum Post Page Template
        if (!is_object(PageTemplate::getByHandle('forum_post'))) {
            $pageTemplate = PageTemplate::add('forum_post', 'Forum Post', 'landing.png', $pkg);
        }
        // Add Forum Post Page Type
        if (!is_object(PageType::getByHandle('forum_post'))) {
//.........这里部分代码省略.........
开发者ID:katzueno,项目名称:forums,代码行数:101,代码来源:controller.php

示例11: t

<?php

defined('C5_EXECUTE') or die("Access Denied.");
use URL;
use Concrete\Core\Block\BlockType\BlockType;
use Concrete\Core\Attribute\Type as AttributeType;
use Concrete\Core\Page\Type\Type as CollectionType;
$c = Page::getCurrentPage();
$fm = Loader::helper('form');
$bt = BlockType::getByHandle('related_pages');
$akIDs = explode(',', $akID);
$at = AttributeType::getByHandle('select');
$atID = $at->getAttributeTypeID();
$list = $controller->getList(array('AttributeKeys.atID' => $atID));
$AJAXselect = URL::to('/problog/tools/nab_attribute');
//var_dump($AJAXselect);
?>
<div id="ccm-relatedpagesPane-add" class="ccm-relatedpagesPane">
	<div class="ccm-block-field-group">
	  <h4><?php 
echo t('Number and Type of Pages');
?>
</h4>
	  <?php 
echo t('Display');
?>
	  <input type="text" name="num" value="<?php 
echo $num;
?>
" style="width: 30px">
	  <?php 
开发者ID:baardev,项目名称:lbtb,代码行数:31,代码来源:form.php

示例12: importAttributes

 protected function importAttributes(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributekeys)) {
         foreach ($sx->attributekeys->attributekey as $ak) {
             $akc = AttributeKeyCategory::getByHandle($ak['category']);
             $pkg = static::getPackageObject($ak['package']);
             $type = AttributeType::getByHandle($ak['type']);
             $txt = Loader::helper('text');
             $c1 = '\\Concrete\\Core\\Attribute\\Key\\' . $txt->camelcase($akc->getAttributeKeyCategoryHandle()) . 'Key';
             $ak = call_user_func(array($c1, 'import'), $ak);
         }
     }
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:13,代码来源:ContentImporter.php

示例13: installProductAttributes

 public static function installProductAttributes(Package $pkg)
 {
     //create custom attribute category for products
     $pakc = AttributeKeyCategory::getByHandle('store_product');
     if (!is_object($pakc)) {
         $pakc = AttributeKeyCategory::add('store_product', AttributeKeyCategory::ASET_ALLOW_SINGLE, $pkg);
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('text'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('textarea'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('number'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('address'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('boolean'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('date_time'));
     }
 }
开发者ID:pvernaglia,项目名称:vivid_store,代码行数:14,代码来源:Installer.php

示例14: importAttributeTypes

 protected function importAttributeTypes()
 {
     $types = array('express' => 'Express Entity', 'email' => 'Email Address', 'telephone' => 'Telephone', 'url' => 'URL');
     $categories = array('file', 'user', 'collection');
     foreach ($types as $handle => $name) {
         $type = Type::getByHandle($handle);
         if (!is_object($type)) {
             $type = Type::add($handle, $name);
             foreach ($categories as $category) {
                 $cat = Category::getByHandle($category);
                 $cat->getController()->associateAttributeKeyType($type);
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:15,代码来源:Version20160725000000.php

示例15: attributeType

 /**
  * @return AttributeType
  */
 private function attributeType($handle)
 {
     if (is_null($this->{"at_{$handle}"})) {
         $attributeType = \Concrete\Core\Attribute\Type::getByHandle($handle);
         if (is_object($attributeType) && $attributeType->getAttributeTypeID() >= 1) {
             $this->{"at_{$handle}"} = $attributeType;
         }
     }
     return $this->{"at_{$handle}"};
 }
开发者ID:jhartman86,项目名称:jhmrfc,代码行数:13,代码来源:controller.php


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