本文整理汇总了PHP中Concrete\Core\Attribute\Type::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::add方法的具体用法?PHP Type::add怎么用?PHP Type::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Attribute\Type
的用法示例。
在下文中一共展示了Type::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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);
}
示例3: 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);
}
示例4: setUp
protected function setUp()
{
$this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'FileImageThumbnailTypes', 'FilePermissionAssignments', 'AttributeKeyCategories', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'AttributeValues', 'atNumber', 'Logs', 'FileVersionLog'));
parent::setUp();
Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
$category = Category::add('file');
$number = AttributeType::add('number', 'Number');
FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
CacheLocal::flush();
}
示例5: setUp
protected function setUp()
{
$this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'FileImageThumbnailTypes', 'FilePermissionAssignments', 'AttributeKeyCategories', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'SystemContentEditorSnippets', 'AttributeValues', 'atNumber', 'FileVersionLog'));
parent::setUp();
define('UPLOAD_FILE_EXTENSIONS_ALLOWED', '*.txt;*.jpg;*.jpeg;*.png');
Category::add('file');
$number = AttributeType::add('number', 'Number');
FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
CacheLocal::flush();
}
示例6: 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));
}
}
示例7: 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);
}
示例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: setUp
protected function setUp()
{
$this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'AttributeKeyCategories', 'AttributeSetKeys', 'Packages', 'AttributeSets', 'FileImageThumbnailTypes', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'AttributeValues', 'FileSets', 'atNumber', 'FileVersionLog', 'FileSetFiles'));
parent::setUp();
\Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
Category::add('file');
\Concrete\Core\Permission\Access\Entity\Type::add('file_uploader', 'File Uploader');
$number = AttributeType::add('number', 'Number');
FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
mkdir($this->getStorageDirectory());
$this->getStorageLocation();
$sample = dirname(__FILE__) . '/StorageLocation/fixtures/sample.txt';
$image = DIR_BASE . '/concrete/images/logo.png';
$fi = new Importer();
$files = array('sample1.txt' => $sample, 'sample2.txt' => $sample, 'sample4.txt' => $sample, 'sample5.txt' => $sample, 'awesome.txt' => $sample, 'testing.txt' => $sample, 'logo1.png' => $image, 'logo2.png' => $image, 'logo3.png' => $image, 'foobley.png' => $image, 'test.png' => $image);
foreach ($files as $filename => $pointer) {
$fi->import($pointer, $filename);
}
$this->list = new \Concrete\Core\File\FileList();
$this->list->ignorePermissions();
}
示例10: 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);
}
}
}
}
}
示例11: install_pb_attributes
public function install_pb_attributes($pkg)
{
$eaku = AttributeKeyCategory::getByHandle('collection');
$eaku->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
$evset = $eaku->addSet('problog', t('ProBlog'), $pkg);
$bset = AttributeSet::getByHandle('problog_additional_attributes');
if (!is_object($bset)) {
$bset = $eaku->addSet('problog_additional_attributes', t('ProBlog Additional Attributes'), $pkg);
}
$userpicker = AttributeType::getByHandle('user_picker');
if (!is_object($userpicker) || !intval($userpicker->getAttributeTypeID())) {
$userpicker = AttributeType::add('user_picker', tc('AttributeTypeName', 'User Picker'), $pkg);
$eaku->associateAttributeKeyType($userpicker);
}
$multiuserpicker = AttributeType::getByHandle('multi_user_picker');
if (!is_object($multiuserpicker) || !intval($multiuserpicker->getAttributeTypeID())) {
$multiuserpicker = AttributeType::add('multi_user_picker', tc('AttributeTypeName', 'Multi User Picker'), $pkg);
$eaku->associateAttributeKeyType($multiuserpicker);
}
$posttotwitter = AttributeType::getByHandle('post_to_twitter');
if (!is_object($posttotwitter) || !intval($posttotwitter->getAttributeTypeID())) {
$posttotwitter = AttributeType::add('post_to_twitter', tc('AttributeTypeName', 'Post To Twitter'), $pkg);
$eaku->associateAttributeKeyType($posttotwitter);
}
$subscribe = AttributeType::getByHandle('subscribe');
if (!is_object($subscribe) || !intval($subscribe->getAttributeTypeID())) {
$subscribe = AttributeType::add('subscribe', tc('AttributeTypeName', 'Subscribe'), $pkg);
$eaku->associateAttributeKeyType($subscribe);
}
$composeroptmizer = AttributeType::getByHandle('composer_optimizer');
if (!is_object($composeroptmizer) || !intval($composeroptmizer->getAttributeTypeID())) {
$composeroptmizer = AttributeType::add('composer_optimizer', tc('AttributeTypeName', 'ProBlog Optimizer'), $pkg);
$eaku->associateAttributeKeyType($composeroptmizer);
}
$blogauth = CollectionAttributeKey::getByHandle('blog_author');
if (!is_object($blogauth)) {
CollectionAttributeKey::add($userpicker, array('akHandle' => 'blog_author', 'akName' => t('Blog Author')), $pkg)->setAttributeSet($evset);
}
$checkn = AttributeType::getByHandle('boolean');
$blogsec = CollectionAttributeKey::getByHandle('blog_section');
if (!is_object($blogsec)) {
CollectionAttributeKey::add($checkn, array('akHandle' => 'blog_section', 'akName' => t('Blog Section'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1), $pkg)->setAttributeSet($evset);
}
$checkn = AttributeType::getByHandle('boolean');
$cannonpage = CollectionAttributeKey::getByHandle('is_canonical_page');
if (!is_object($cannonpage)) {
CollectionAttributeKey::add($checkn, array('akHandle' => 'is_canonical_page', 'akName' => t('Is Canonical Page'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1), $pkg)->setAttributeSet($evset);
}
$pulln = AttributeType::getByHandle('select');
$blogcat = CollectionAttributeKey::getByHandle('blog_category');
if (!is_object($blogcat)) {
CollectionAttributeKey::add($pulln, array('akHandle' => 'blog_category', 'akName' => t('Blog Category'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akSelectAllowOtherValues' => true), $pkg)->setAttributeSet($evset);
}
$blogtag = CollectionAttributeKey::getByHandle('tags');
if (!is_object($blogtag)) {
CollectionAttributeKey::add($pulln, array('akHandle' => 'tags', 'akName' => t('Tags'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akSelectAllowMultipleValues' => true, 'akSelectAllowOtherValues' => true), $pkg)->setAttributeSet($evset);
} else {
$blogtag->update(array('akHandle' => 'tags', 'akName' => t('Tags'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akSelectAllowMultipleValues' => true, 'akSelectAllowOtherValues' => true));
}
$imagen = AttributeType::getByHandle('image_file');
$blogthum = CollectionAttributeKey::getByHandle('thumbnail');
if (!is_object($blogthum)) {
CollectionAttributeKey::add($imagen, array('akHandle' => 'thumbnail', 'akName' => t('Thumbnail Image')), $pkg)->setAttributeSet($evset);
}
$send_subscribe = CollectionAttributeKey::getByHandle('send_subscription');
if (!is_object($send_subscribe)) {
CollectionAttributeKey::add($subscribe, array('akHandle' => 'send_subscription', 'akName' => t('Send To Subscribers')), $pkg)->setAttributeSet($evset);
}
$postBlogToTwitter = CollectionAttributeKey::getByHandle('post_to_twitter');
if (!is_object($postBlogToTwitter)) {
CollectionAttributeKey::add($posttotwitter, array('akHandle' => 'post_to_twitter', 'akName' => t('Post To Twitter')), $pkg)->setAttributeSet($evset);
}
$composerBlogOptimizer = CollectionAttributeKey::getByHandle('composer_optimizer');
if (!is_object($composerBlogOptimizer)) {
CollectionAttributeKey::add($composeroptmizer, array('akHandle' => 'composer_optimizer', 'akName' => t('ProBlog Optimizer')), $pkg)->setAttributeSet($evset);
}
$users = CollectionAttributeKey::getByHandle('subscription');
if (!is_object($users)) {
$users = array('akHandle' => 'subscription', 'akName' => 'Subscribed Members', 'akIsSearchable' => 0, 'akIsSearchableIndexed' => 0, 'akIsAutoCreated' => 1, 'akIsEditable' => 1);
$users = CollectionAttributeKey::add($multiuserpicker, $users, $pkg);
}
}
示例12: 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);
}
}
}
}
示例13: add_attribute_types
public function add_attribute_types()
{
// add attribute type price
$at_price = AttributeType::getByHandle('price');
if (!is_object($at_price)) {
$at_price = AttributeType::add('price', 'Price', $this->pkg);
}
// add attribute type composer menu
$at_cm = AttributeType::getByHandle('composer_menu');
if (!is_object($at_cm)) {
$at_cm = AttributeType::add('composer_menu', 'Composer Menu', $this->pkg);
}
// associate attribute types with category
$akc = AttributeKeyCategory::getByHandle('collection');
$akc->associateAttributeKeyType($at_price);
$akc->associateAttributeKeyType($at_cm);
}
示例14: setupAttributeTypes
/**
* @return Controller
*/
private function setupAttributeTypes()
{
$atPageSelector = $this->attributeType('page_selector');
if (!$atPageSelector instanceof \Concrete\Core\Attribute\Type) {
\Concrete\Core\Attribute\Type::add('page_selector', t('Page Selector'), $this->packageObject());
$this->attributeKeyCategory('file')->associateAttributeKeyType($this->attributeType('page_selector'));
}
return $this;
}
示例15: importAttributeTypes
protected function importAttributeTypes(\SimpleXMLElement $sx)
{
if (isset($sx->attributetypes)) {
foreach ($sx->attributetypes->attributetype as $at) {
$pkg = static::getPackageObject($at['package']);
$name = $at['name'];
if (!$name) {
$name = Core::make('helper/text')->unhandle($at['handle']);
}
$type = AttributeType::getByHandle($at['handle']);
if (!is_object($type)) {
$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);
}
}
}
}
}