本文整理汇总了PHP中BlockType::installBlockTypeFromPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockType::installBlockTypeFromPackage方法的具体用法?PHP BlockType::installBlockTypeFromPackage怎么用?PHP BlockType::installBlockTypeFromPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockType
的用法示例。
在下文中一共展示了BlockType::installBlockTypeFromPackage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install()
{
$pkg = parent::install();
Loader::model('single_page');
Loader::model('job');
// install job
$jb = Job::installByPackage('generate_multilingual_sitemap', $pkg);
$p = SinglePage::add('/dashboard/multilingual', $pkg);
if (is_object($p)) {
$p->update(array('cName' => t('Multilingual'), 'cDescription' => t('Translate your site.')));
}
$p1 = SinglePage::add('/dashboard/multilingual/setup', $pkg);
if (is_object($p1)) {
$p1->update(array('cName' => t('Setup'), 'cDescription' => ''));
}
$p2 = SinglePage::add('/dashboard/multilingual/page_report', $pkg);
if (is_object($p2)) {
$p2->update(array('cName' => t('Page Report'), 'cDescription' => ''));
}
BlockType::installBlockTypeFromPackage('switch_language', $pkg);
$ak = CollectionAttributeKey::getByHandle('multilingual_exclude_from_copy');
if (!is_object($ak)) {
CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'multilingual_exclude_from_copy', 'akName' => t('Exclude from Internationalization Copy'), 'akIsSearchable' => true), $pkg);
}
}
示例2: getOrInstallBlockType
private function getOrInstallBlockType($pkg, $btHandle)
{
$bt = BlockType::getByHandle($btHandle);
if (empty($bt)) {
BlockType::installBlockTypeFromPackage($btHandle, $pkg);
$bt = BlockType::getByHandle($btHandle);
}
return $bt;
}
示例3: install
public function install()
{
$pkg = parent::install();
//Install block
BlockType::installBlockTypeFromPackage('custom_contact_form', $pkg);
//Install dashboard page
Loader::model('single_page');
$p = SinglePage::add('/dashboard/reports/custom_contact_form', $pkg);
$p->update(array('cName' => t('Contact Form Submissions')));
$p->setAttribute('icon_dashboard', 'icon-list-alt');
}
示例4: install
public function install()
{
$pkg = parent::install();
Loader::model('single_page');
Loader::model('attribute/categories/collection');
// install attributes
$cab1 = CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'easynews_section', 'akName' => t('NEWS Section'), 'akIsSearchable' => true), $pkg);
//install pages
$def = SinglePage::add('/dashboard/easy_news', $pkg);
$def->update(array('cName' => 'Easy News', 'cDescription' => t('Manage site news.')));
$def = SinglePage::add('/dashboard/easy_news/help', $pkg);
$def->update(array('cName' => 'Easy News Help', 'cDescription' => t('Easy News help.')));
//install block
BlockType::installBlockTypeFromPackage('easynews_list', $pkg);
}
示例5: install
public function install()
{
Loader::library('mootools/attribute', FRONTEND_DEVELOPER_PACKAGE_HANDLE);
$pkg = parent::install();
Loader::model('single_page');
Loader::model('attribute/categories/user');
Loader::model('attribute/categories/file');
$singlePages = array("/dashboard/mootools" => array('cName' => t('Mootools Plugin Developer'), 'cDescription' => t('Management of mootools plugin')), "/dashboard/mootools/plugin" => array('cName' => t('plugin'), 'cDescription' => t('Management of Mootools Plugin that does import')), "/dashboard/mootools/importer" => array('cName' => t('import'), 'cDescription' => t('Import from repository')));
foreach ($singlePages as $key => $page) {
$collection = SinglePage::add($key, $pkg);
if (!empty($collection)) {
$collection->update($page);
}
}
//The name of the user of github is added to the attribute.
$values = array("akHandle" => MOOTOOLS_GITHUB_USER, "akName" => t("Name of user of github"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true);
$key = UserAttributeKey::add("text", $values, $pkg);
$fileAttributes = array(array("type" => "boolean", "values" => array("akHandle" => MOOTOOLS_PLUGIN, "akName" => t("This file is a plugin of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_COMPONENT_NAME, "akName" => t("Component name of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_LICENSE, "akName" => t("License of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_AUTHORS, "akName" => t("Authors of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "select", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DEPENDENCES, "akName" => t("Dependence of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "number", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DISPLAY_ORDER, "akName" => t("The order of display of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)));
$attributesKeys = array();
foreach ($fileAttributes as $key => $attr) {
$type = $attr["type"];
$values = $attr["values"];
$handle = $values["akHandle"];
$attributesKeys[$handle] = FileAttributeKey::add($type, $values, $pkg);
}
if (!empty($attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES])) {
$key = $attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES];
$db = Loader::db();
$db->Replace('atSelectSettings', array('akID' => $key->getAttributeKeyID(), 'akSelectAllowMultipleValues' => true), array('akID'), true);
}
BlockType::installBlockTypeFromPackage("mootools_plugin_build_form", $pkg);
BlockType::installBlockTypeFromPackage("github_tags", $pkg);
BlockType::installBlockTypeFromPackage("github_issues", $pkg);
BlockType::installBlockTypeFromPackage("github_repository", $pkg);
PageTheme::add('small_project', $pkg);
}
示例6: installBlocks
private function installBlocks($pkg)
{
$bt = BlockType::getByHandle('boilerplate_callout');
if (!$bt || !is_object($bt)) {
BlockType::installBlockTypeFromPackage('boilerplate_callout', $pkg);
} else {
// the block already exists, so we want
// to update it to use the block from our package
// this might not be OK for marketplace stuff if
// you are modifying other packages or the core
Loader::db()->execute('update Pages set pkgID = ? where btID = ?', array($pkg->pkgID, $bt->getBlockTypeID()));
}
}
示例7: refresh
/**
* refreshes the BlockType's database schema throws an Exception if error
* @return void
*/
public function refresh() {
if ($this->getPackageID() > 0) {
$pkg = Package::getByID($this->getPackageID());
$resp = BlockType::installBlockTypeFromPackage($this->getBlockTypeHandle(), $pkg, $this->getBlockTypeID());
if ($resp != '') {
throw new Exception($resp);
}
} else {
$resp = BlockType::installBlockType($this->getBlockTypeHandle(), $this->getBlockTypeID());
if ($resp != '') {
throw new Exception($resp);
}
}
}
示例8: install
public function install()
{
$pkg = parent::install();
//install block
BlockType::installBlockTypeFromPackage('easyslider_slideshow', $pkg);
}
示例9: importBlockTypes
protected function importBlockTypes(SimpleXMLElement $sx) {
if (isset($sx->blocktypes)) {
foreach($sx->blocktypes->blocktype as $bt) {
$pkg = ContentImporter::getPackageObject($bt['package']);
if (is_object($pkg)) {
BlockType::installBlockTypeFromPackage($bt['handle'], $pkg);
} else {
BlockType::installBlockType($bt['handle']);
}
}
}
}
示例10: configurePackage
public function configurePackage($pkg)
{
$theme = Theme::getByHandle('worldskills');
if (!is_object($theme)) {
$theme = Theme::add('worldskills', $pkg);
}
// add skill ID attribute
$attributeKey = CollectionAttributeKey::getByHandle('worldskills_skill_id');
if (!is_object($attributeKey)) {
$type = AttributeType::getByHandle('text');
$args = array('akHandle' => 'worldskills_skill_id', 'akName' => t('Skill ID'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1);
CollectionAttributeKey::add($type, $args, $pkg);
}
// add skill page type
$pageType = \PageType::getByHandle('worldskills_skill');
if (!is_object($pageType)) {
$template = \PageTemplate::getByHandle('full');
\PageType::add(array('handle' => 'worldskills_skill', 'name' => 'Skill', 'defaultTemplate' => $template, 'allowedTemplates' => 'C', 'templates' => array($template), 'ptLaunchInComposer' => 0, 'ptIsFrequentlyAdded' => 0), $pkg)->setConfiguredPageTypePublishTargetObject(new PageTypePublishTargetAllConfiguration(PageTypePublishTargetAllType::getByHandle('all')));
}
// add member ID attribute
$attributeKey = CollectionAttributeKey::getByHandle('worldskills_member_id');
if (!is_object($attributeKey)) {
$type = AttributeType::getByHandle('text');
$args = array('akHandle' => 'worldskills_member_id', 'akName' => t('Member ID'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1);
CollectionAttributeKey::add($type, $args, $pkg);
}
// add member page type
$pageType = \PageType::getByHandle('worldskills_member');
if (!is_object($pageType)) {
$template = \PageTemplate::getByHandle('full');
\PageType::add(array('handle' => 'worldskills_member', 'name' => 'Member', 'defaultTemplate' => $template, 'allowedTemplates' => 'C', 'templates' => array($template), 'ptLaunchInComposer' => 0, 'ptIsFrequentlyAdded' => 0), $pkg)->setConfiguredPageTypePublishTargetObject(new PageTypePublishTargetAllConfiguration(PageTypePublishTargetAllType::getByHandle('all')));
}
// add skill block
$blockType = \BlockType::getByHandle('worldskills_skill');
if (!is_object($blockType)) {
\BlockType::installBlockTypeFromPackage('worldskills_skill', $pkg);
}
// add skill list block
$blockType = \BlockType::getByHandle('worldskills_skill_list');
if (!is_object($blockType)) {
\BlockType::installBlockTypeFromPackage('worldskills_skill_list', $pkg);
}
// add people block
$blockType = \BlockType::getByHandle('worldskills_people');
if (!is_object($blockType)) {
\BlockType::installBlockTypeFromPackage('worldskills_people', $pkg);
}
// add member block
$blockType = \BlockType::getByHandle('worldskills_member');
if (!is_object($blockType)) {
\BlockType::installBlockTypeFromPackage('worldskills_member', $pkg);
}
// add member list block
$blockType = \BlockType::getByHandle('worldskills_member_list');
if (!is_object($blockType)) {
\BlockType::installBlockTypeFromPackage('worldskills_member_list', $pkg);
}
try {
$authenticationType = AuthenticationType::getByHandle('worldskills');
} catch (\Exception $e) {
$authenticationType = AuthenticationType::add('worldskills', 'WorldSkills Auth', 0, $pkg);
$authenticationType->disable();
}
$page = \SinglePage::add('/dashboard/system/basics/worldskills', $pkg);
if (is_object($pag)) {
$page->updateCollectionName('WorldSkills');
}
\Config::save('worldskills.api_url', \Config::get('worldskills.api_url', 'https://api.worldskills.org'));
\Config::save('worldskills.authorize_url', \Config::get('worldskills.authorize_url', 'https://auth.worldskills.org'));
}
示例11: install
function install()
{
$pkg = parent::install();
BlockType::installBlockTypeFromPackage('tweetcrete', $pkg);
}
示例12: addBlock
private function addBlock($blockHandle)
{
if (!is_object(BlockType::getByHandle($blockHandle))) {
BlockType::installBlockTypeFromPackage($blockHandle, $this->pkg);
}
}
示例13: install
public function install()
{
$pkg = parent::install();
BlockType::installBlockTypeFromPackage($this->pkgHandle, $pkg);
$this->installPageLinkAttribute($pkg);
}