本文整理汇总了PHP中AttributeType::add方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeType::add方法的具体用法?PHP AttributeType::add怎么用?PHP AttributeType::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeType
的用法示例。
在下文中一共展示了AttributeType::add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installOrUpgrade
private function installOrUpgrade($pkg, $fromVersion)
{
$at = AttributeType::getByHandle('handle_https');
if (!is_object($at)) {
$at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
}
$akc = AttributeKeyCategory::getByHandle('collection');
if (is_object($akc)) {
if (!$akc->hasAttributeKeyTypeAssociated($at)) {
$akc->associateAttributeKeyType($at);
}
}
if (empty($fromVersion)) {
$ak = CollectionAttributeKey::getByHandle('handle_https');
if (!is_object($ak)) {
$hhh = Loader::helper('https_handling', 'handle_https');
/* @var $hhh HttpsHandlingHelper */
$httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
if (!$httpDomain) {
$httpDomain = 'http://' . $hhh->getRequestDomain();
}
$httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
if (!$httpsDomain) {
$httpsDomain = 'https://' . $hhh->getRequestDomain();
}
$ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
}
}
}
示例2: install
public function install()
{
$pkg = parent::install();
$pkgh = Package::getByHandle('page_selector_attribute');
Loader::model('attribute/categories/collection');
$col = AttributeKeyCategory::getByHandle('collection');
$pageselector = AttributeType::add('page_selector', t('Page Selector'), $pkgh);
$col->associateAttributeKeyType(AttributeType::getByHandle('page_selector'));
}
示例3: install
public function install() {
$at = parent::add($this->atHandle, $this->atName);
}
示例4: installCoreAttributeItems
protected function installCoreAttributeItems() {
$cakc = AttributeKeyCategory::getByHandle('collection');
if (is_object($cakc)) {
return false;
}
$cakc = AttributeKeyCategory::add('collection');
$uakc = AttributeKeyCategory::add('user');
$fakc = AttributeKeyCategory::add('file');
$tt = AttributeType::add('text', t('Text'));
$textareat = AttributeType::add('textarea', t('Text Area'));
$boolt = AttributeType::add('boolean', t('Checkbox'));
$dtt = AttributeType::add('date_time', t('Date/Time'));
$ift = AttributeType::add('image_file', t('Image/File'));
$nt = AttributeType::add('number', t('Number'));
$rt = AttributeType::add('rating', t('Rating'));
$st = AttributeType::add('select', t('Select'));
$addresst = AttributeType::add('address', t('Address'));
// assign collection attributes
$cakc->associateAttributeKeyType($tt);
$cakc->associateAttributeKeyType($textareat);
$cakc->associateAttributeKeyType($boolt);
$cakc->associateAttributeKeyType($dtt);
$cakc->associateAttributeKeyType($ift);
$cakc->associateAttributeKeyType($nt);
$cakc->associateAttributeKeyType($rt);
$cakc->associateAttributeKeyType($st);
// assign user attributes
$uakc->associateAttributeKeyType($tt);
$uakc->associateAttributeKeyType($textareat);
$uakc->associateAttributeKeyType($boolt);
$uakc->associateAttributeKeyType($dtt);
$uakc->associateAttributeKeyType($nt);
$uakc->associateAttributeKeyType($st);
$uakc->associateAttributeKeyType($addresst);
// assign file attributes
$fakc->associateAttributeKeyType($tt);
$fakc->associateAttributeKeyType($textareat);
$fakc->associateAttributeKeyType($boolt);
$fakc->associateAttributeKeyType($dtt);
$fakc->associateAttributeKeyType($nt);
$fakc->associateAttributeKeyType($rt);
$fakc->associateAttributeKeyType($st);
}
示例5: importAttributeTypes
protected function importAttributeTypes(SimpleXMLElement $sx) {
if (isset($sx->attributetypes)) {
foreach($sx->attributetypes->attributetype as $at) {
$pkg = ContentImporter::getPackageObject($at['package']);
$name = $at['name'];
if (!$name) {
$name = Loader::helper('text')->unhandle($at['handle']);
}
$type = AttributeType::add($at['handle'], $name, $pkg);
if (isset($at->categories)) {
foreach($at->categories->children() as $cat) {
$catobj = AttributeKeyCategory::getByHandle((string) $cat['handle']);
$catobj->associateAttributeKeyType($type);
}
}
}
}
}