1 Star 0 Fork 37

bobo/WeeShop

forked from WeeShop/WeeShop 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
weeshop.install 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
solody 提交于 2019-11-16 16:27 . 重命名profile
<?php
/**
* @file
* Install, update and uninstall functions for the commerce_base installation profile.
*/
use Drupal\user\Entity\User;
use Drupal\user\RoleInterface;
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function weeshop_install() {
// Set front page to "node".
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE);
// Allow visitor account creation with administrative approval.
$user_settings = \Drupal::configFactory()->getEditable('user.settings');
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(TRUE);
// Enable default permissions for system roles.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access comments', 'post comments', 'skip comment approval']);
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
$user->save();
// Enable the Contact link in the footer menu.
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$menu_link_manager->updateDefinition('contact.site_page', ['enabled' => TRUE]);
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access site-wide contact form']);
// Allow all users to use search.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['search content']);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['search content']);
// Enable the admin theme.
\Drupal::configFactory()->getEditable('node.settings')->set('use_admin_theme', TRUE)->save(TRUE);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/baitongda/WeeShop.git
git@gitee.com:baitongda/WeeShop.git
baitongda
WeeShop
WeeShop
8.x-1.x

搜索帮助