本文整理汇总了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;
}
示例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));
}
示例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;
}
示例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));
}
}
示例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);
}
}
}
}
示例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);
}
示例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')));
}
}
示例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);
}
}
}
}
}
示例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);
}
示例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'))) {
//.........这里部分代码省略.........
示例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
示例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);
}
}
}
示例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'));
}
}
示例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);
}
}
}
}
示例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}"};
}