Implements hook_install().
Perform actions to set up the site for this profile.
function standard_install() {
// Enable Bartik theme and set it as default theme instead of Stark.
// @see system_install()
$default_theme = 'bartik';
config('system.theme')
->set('default', $default_theme)
->save();
theme_enable(array(
$default_theme,
));
theme_disable(array(
'stark',
));
// Set front page to "node".
config('system.site')
->set('page.front', 'node')
->save();
// Insert default pre-defined node types into the database. For a complete
// list of available node type attributes, refer to the node type API
// documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
$types = array(
array(
'type' => 'page',
'name' => st('Basic page'),
'base' => 'node_content',
'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
array(
'type' => 'article',
'name' => st('Article'),
'base' => 'node_content',
'description' => st('Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.'),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
}
// Insert default pre-defined RDF mapping into the database.
$rdf_mappings = array(
array(
'type' => 'node',
'bundle' => 'page',
'mapping' => array(
'rdftype' => array(
'foaf:Document',
),
),
),
array(
'type' => 'node',
'bundle' => 'article',
'mapping' => array(
'field_image' => array(
'predicates' => array(
'og:image',
'rdfs:seeAlso',
),
'type' => 'rel',
),
'field_tags' => array(
'predicates' => array(
'dc:subject',
),
'type' => 'rel',
),
),
),
);
foreach ($rdf_mappings as $rdf_mapping) {
rdf_mapping_save($rdf_mapping);
}
// Default "Basic page" to not be promoted and have comments disabled.
variable_set('node_options_page', array(
'status',
));
variable_set('comment_page', COMMENT_NODE_HIDDEN);
// Don't display date and author information for "Basic page" nodes by default.
variable_set('node_submitted_page', FALSE);
// Allow visitor account creation with administrative approval.
$user_settings = config('user.settings');
$user_settings
->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)
->save();
// Create user picture field.
module_load_install('user');
user_install_picture_field();
// Enable default permissions for system roles.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access content',
'access comments',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access content',
'access comments',
'post comments',
'skip comment approval',
));
// Enable all permissions for the administrator role.
user_role_grant_permissions('administrator', array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
$user_settings
->set('admin_role', 'administrator')
->save();
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array(
'uid' => 1,
'rid' => 'administrator',
))
->execute();
// Create a Home link in the main menu.
$menu_link = entity_create('menu_link', array(
'link_title' => st('Home'),
'link_path' => '<front>',
'menu_name' => 'main',
));
$menu_link
->save();
// Enable the Contact link in the footer menu.
menu_link_maintain('system', 'enable', 'contact');
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access site-wide contact form',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access site-wide contact form',
));
// Populate the default shortcut set.
$shortcut_set = shortcut_set_load('default');
$menu_link = entity_create('menu_link', array(
'link_path' => 'node/add',
'link_title' => st('Add content'),
'weight' => -20,
));
$menu_link
->save();
$shortcut_set->links[$menu_link
->uuid()] = $menu_link;
$menu_link = entity_create('menu_link', array(
'link_path' => 'admin/content',
'link_title' => st('All content'),
'weight' => -19,
));
$menu_link
->save();
$shortcut_set->links[$menu_link
->uuid()] = $menu_link;
$shortcut_set
->save();
// Enable the admin theme.
theme_enable(array(
'seven',
));
config('system.theme')
->set('admin', 'seven')
->save();
variable_set('node_admin_theme', '1');
}