本文整理汇总了PHP中Concrete\Core\Attribute\Type类的典型用法代码示例。如果您正苦于以下问题:PHP Type类的具体用法?PHP Type怎么用?PHP Type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Type类的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($id = null, $type = null)
{
$this->select_type($id, $type);
$type = Type::getByID($type);
$entity = $this->getEntity($id);
$this->set('entity', $entity);
$this->executeAdd($type, \URL::to('/dashboard/system/express/entities/attributes', 'view', $id));
}
示例4: 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);
}
示例5: 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();
}
示例6: getResults
public function getResults(Request $request)
{
$list = Type::getAttributeTypeList();
$items = array();
foreach ($list as $type) {
$attributeType = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\AttributeType();
$attributeType->setItemId($type->getAttributeTypeID());
$items[] = $attributeType;
}
return $items;
}
示例7: 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);
}
示例8: 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();
}
示例9: 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;
}
示例10: 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));
}
}
示例11: save_attribute_type_associations
public function save_attribute_type_associations()
{
$list = Category::getList();
foreach ($list as $cat) {
$cat->clearAttributeKeyCategoryTypes();
if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) {
foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) {
$type = Type::getByID($id);
$cat->associateAttributeKeyType($type);
}
}
}
$this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated');
}
示例12: add
public function add()
{
$this->select_type();
$type = $this->get('type');
$cnt = $type->getController();
$e = $cnt->validateKey($this->post());
if ($e->has()) {
$this->set('error', $e);
} else {
$type = AttributeType::getByID($this->post('atID'));
StoreProductKey::add($type, $this->post());
$this->redirect('/dashboard/store/products/attributes/', 'success');
}
}
示例13: 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);
}
}
}
}
示例14: 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);
}
示例15: 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')));
}
}