本文整理汇总了PHP中Concrete\Core\Attribute\Key\Category::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::add方法的具体用法?PHP Category::add怎么用?PHP Category::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Attribute\Key\Category
的用法示例。
在下文中一共展示了Category::add方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
Category::add('collection');
Page::addHomePage();
PageTemplate::add('full', 'Full');
PageType::add(array('handle' => 'basic', 'name' => 'Basic'));
}
示例2: 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();
}
示例3: 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();
}
示例4: 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);
}
}
}
}
示例5: execute
public function execute(Batch $batch)
{
$categories = $batch->getObjectCollection('attribute_key_category');
if (!$categories) {
return;
}
foreach ($categories->getCategories() as $category) {
if (!$category->getPublisherValidator()->skipItem()) {
$pkg = null;
if ($category->getPackage()) {
$pkg = \Package::getByHandle($category->getPackage());
}
Category::add($category->getHandle(), $category->getAllowSets(), $pkg);
}
}
}
示例6: 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();
}
示例7: installAttributeCategoryAndObject
protected function installAttributeCategoryAndObject()
{
$this->category = Category::add('collection');
$this->object = Page::addHomePage();
}
示例8: install
public function install()
{
$pkg = parent::install();
//install our dashboard singlepages
SinglePage::add('/dashboard/store/', $pkg);
SinglePage::add('/dashboard/store/orders/', $pkg);
SinglePage::add('/dashboard/store/products/', $pkg);
SinglePage::add('/dashboard/store/products/attributes', $pkg);
SinglePage::add('/dashboard/store/settings/', $pkg);
//install our cart/checkout pages
SinglePage::add('/cart/', $pkg);
SinglePage::add('/checkout/', $pkg);
SinglePage::add('/checkout/complete', $pkg);
Page::getByPath('/cart/')->setAttribute('exclude_nav', 1);
Page::getByPath('/checkout/')->setAttribute('exclude_nav', 1);
Page::getByPath('/checkout/complete')->setAttribute('exclude_nav', 1);
//install a default page to pushlish products under
$productParentPage = Page::getByPath('/product-detail');
if ($productParentPage->isError()) {
$productParentPage = Page::getByID(1)->add(PageType::getByHandle('page'), array('cName' => t('Product Detail'), 'cHandle' => 'product-detail', 'pkgID' => $pkg->pkgID), PageTemplate::getByHandle('full'));
}
Page::getByPath('/product-detail')->setAttribute('exclude_nav', 1);
$this->installStoreProductPageType($pkg);
Config::save('vividstore.productPublishTarget', $productParentPage->getCollectionID());
//install our blocks
BlockTypeSet::add("vivid_store", "Store", $pkg);
BlockType::installBlockTypeFromPackage('vivid_product_list', $pkg);
BlockType::installBlockTypeFromPackage('vivid_utility_links', $pkg);
BlockType::installBlockTypeFromPackage('vivid_product', $pkg);
//install some default blocks for page type.
$pageType = PageType::getByHandle('store_product');
$template = $pageType->getPageTypeDefaultPageTemplateObject();
$pageObj = $pageType->getPageTypePageTemplateDefaultPageObject($template);
$bt = BlockType::getByHandle('vivid_product');
$blocks = $pageObj->getBlocks('Main');
if (count($blocks) < 1) {
$data = array('productLocation' => 'page', 'showProductName' => 1, 'showProductDescription' => 1, 'showProductDetails' => 1, 'showProductPrice' => 1, 'showImage' => 1, 'showCartButton' => 1, 'showGroups' => 1);
$pageObj->addBlock($bt, 'Main', $data);
}
//set our default currency configs
Config::save('vividstore.symbol', '$');
Config::save('vividstore.whole', '.');
Config::save('vividstore.thousand', ',');
//set defaults for shipping
Config::save('vividstore.sizeUnit', 'in');
Config::save('vividstore.weightUnit', 'l');
//tax label
$pkg->getconfig()->save('vividstore.taxName', t('Tax'));
//user attributes for customers
$uakc = AttributeKeyCategory::getByHandle('user');
$uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_MULTIPLE);
//define attr group, and the different attribute types we'll use
$custSet = $uakc->addSet('customer_info', t('Store Customer Info'), $pkg);
$text = AttributeType::getByHandle('text');
$address = AttributeType::getByHandle('address');
//email
$bFirstname = UserAttributeKey::getByHandle('email');
if (!is_object($bFirstname)) {
UserAttributeKey::add($text, array('akHandle' => 'email', 'akName' => t('Email'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '1'), $pkg)->setAttributeSet($custSet);
}
//billing first name
$bFirstname = UserAttributeKey::getByHandle('billing_first_name');
if (!is_object($bFirstname)) {
UserAttributeKey::add($text, array('akHandle' => 'billing_first_name', 'akName' => t('Billing First Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '1'), $pkg)->setAttributeSet($custSet);
}
//billing last name
$bLastname = UserAttributeKey::getByHandle('billing_last_name');
if (!is_object($bLastname)) {
UserAttributeKey::add($text, array('akHandle' => 'billing_last_name', 'akName' => t('Billing Last Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '2'), $pkg)->setAttributeSet($custSet);
}
//billing address
$bAddress = UserAttributeKey::getByHandle('billing_address');
if (!is_object($bAddress)) {
UserAttributeKey::add($address, array('akHandle' => 'billing_address', 'akName' => t('Billing Address'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '3'), $pkg)->setAttributeSet($custSet);
}
//billing Phone
$bPhone = UserAttributeKey::getByHandle('billing_phone');
if (!is_object($bPhone)) {
UserAttributeKey::add($text, array('akHandle' => 'billing_phone', 'akName' => t('Billing Phone'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '4'), $pkg)->setAttributeSet($custSet);
}
//shipping first name
$sFirstname = UserAttributeKey::getByHandle('shipping_first_name');
if (!is_object($sFirstname)) {
UserAttributeKey::add($text, array('akHandle' => 'shipping_first_name', 'akName' => t('Shipping First Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '1'), $pkg)->setAttributeSet($custSet);
}
//shipping last name
$bLastname = UserAttributeKey::getByHandle('shipping_last_name');
if (!is_object($bLastname)) {
UserAttributeKey::add($text, array('akHandle' => 'shipping_last_name', 'akName' => t('Shipping Last Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '2'), $pkg)->setAttributeSet($custSet);
}
//shipping address
$sAddress = UserAttributeKey::getByHandle('shipping_address');
if (!is_object($sAddress)) {
UserAttributeKey::add($address, array('akHandle' => 'shipping_address', 'akName' => t('Shipping Address'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '3'), $pkg)->setAttributeSet($custSet);
}
//create user group
$group = Group::getByName('Store Customer');
if (!$group || $group->getGroupID() < 1) {
$group = Group::add('Store Customer', t('Registered Customer in your store'));
}
//.........这里部分代码省略.........
示例9: setUp
public function setUp()
{
parent::setUp();
Category::add('user');
}
示例10: 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'));
}
}
示例11: installSite
protected function installSite()
{
$this->output(t('Installing Site object...'));
/**
* @var $service Service
*/
$service = \Core::make('site');
$site = $service->getDefault();
$em = $this->connection->getEntityManager();
$type_service = \Core::make('site/type');
$type = $type_service->getDefault();
if (!is_object($type)) {
$type = $type_service->installDefault();
}
if (!is_object($site) || $site->getSiteID() < 1) {
$locale = 'en_US';
if (\Config::get('concrete.multilingual.default_locale')) {
$locale = \Config::get('concrete.multilingual.default_locale');
}
$site = $service->installDefault($locale);
// migrate name
$site->setSiteName(\Config::get('concrete.site'));
// migrate theme
$c = \Page::getByID(HOME_CID);
$site->setThemeID($c->getCollectionThemeID());
$em->persist($site);
$em->flush();
}
$site = $service->getDefault();
$this->connection->executeQuery('update Pages set siteTreeID = ? where cIsSystemPage = 0', [$site->getSiteTreeID()]);
$this->connection->executeQuery('update Stacks set siteTreeID = ?', [$site->getSiteTreeID()]);
$this->connection->executeQuery('update PageTypes set siteTypeID = ? where ptIsInternal = 0', [$type->getSiteTypeID()]);
// migrate social links
$links = $em->getRepository('Concrete\\Core\\Entity\\Sharing\\SocialNetwork\\Link')->findAll();
foreach ($links as $link) {
$link->setSite($site);
$em->persist($link);
}
$em->flush();
$category = Category::getByHandle('site');
if (!is_object($category)) {
$category = Category::add('site');
} else {
$category = $category->getController();
}
$types = Type::getList();
foreach ($types as $type) {
$category->associateAttributeKeyType($type);
}
$siteConfig = $site->getConfigRepository();
// migrate bookmark icons
$favicon_fid = \Config::get('concrete.misc.favicon_fid');
if ($favicon_fid) {
$siteConfig->save('misc.favicon_fid', $favicon_fid);
}
$iphone_home_screen_thumbnail_fid = \Config::get('concrete.misc.iphone_home_screen_thumbnail_fid');
if ($iphone_home_screen_thumbnail_fid) {
$siteConfig->save('misc.iphone_home_screen_thumbnail_fid', $iphone_home_screen_thumbnail_fid);
}
$modern_tile_thumbnail_fid = \Config::get('concrete.misc.modern_tile_thumbnail_fid');
if ($modern_tile_thumbnail_fid) {
$siteConfig->save('misc.modern_tile_thumbnail_fid', $modern_tile_thumbnail_fid);
}
$modern_tile_thumbnail_bgcolor = \Config::get('concrete.misc.modern_tile_thumbnail_bgcolor');
if ($modern_tile_thumbnail_bgcolor) {
$siteConfig->save('misc.modern_tile_thumbnail_bgcolor', $modern_tile_thumbnail_bgcolor);
}
// migrate url
$canonical_url = \Config::get('seo.canonical_url');
if ($canonical_url) {
$siteConfig->save('seo.canonical_url', $canonical_url);
}
$canonical_ssl_url = \Config::get('seo.canonical_ssl_url');
if ($canonical_ssl_url) {
$siteConfig->save('seo.canonical_ssl_url', $canonical_ssl_url);
}
// migrate tracking code
$header = \Config::get('seo.tracking.code.header');
if ($header) {
$siteConfig->save('seo.tracking.code.header', $header);
}
$footer = \Config::get('seo.tracking.code.footer');
if ($footer) {
$siteConfig->save('seo.tracking.code.footer', $footer);
}
// migrate public profiles
$r = \Config::get('concrete.user.profiles_enabled');
if ($r) {
$siteConfig->save('user.profiles_enabled', $r);
}
$r = \Config::get('concrete.user.gravatar.enabled');
if ($r) {
$siteConfig->save('user.gravatar.enabled', $r);
}
$r = \Config::get('concrete.user.gravatar.max_level');
if ($r) {
$siteConfig->save('user.gravatar.max_level', $r);
}
$r = \Config::get('concrete.user.gravatar.image_set');
if ($r) {
//.........这里部分代码省略.........
示例12: importAttributeCategories
protected function importAttributeCategories(\SimpleXMLElement $sx)
{
if (isset($sx->attributecategories)) {
foreach ($sx->attributecategories->category as $akc) {
$pkg = static::getPackageObject($akc['package']);
$akx = AttributeKeyCategory::getByHandle($akc['handle']);
if (!is_object($akx)) {
$akx = AttributeKeyCategory::add($akc['handle'], $akc['allow-sets'], $pkg);
}
}
}
}
示例13: setUp
protected function setUp()
{
parent::setUp();
Category::add('user');
}