diff options
Diffstat (limited to 'profiles/standard/standard.install')
-rw-r--r-- | profiles/standard/standard.install | 414 |
1 files changed, 414 insertions, 0 deletions
diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install new file mode 100644 index 000000000..5bcf9e39f --- /dev/null +++ b/profiles/standard/standard.install @@ -0,0 +1,414 @@ +<?php +// $Id$ + +/** + * Implements hook_install(). + * + * Perform actions to set up the site for this profile. + */ +function standard_install() { + // Add text formats. + $filtered_html_format = array( + 'name' => 'Filtered HTML', + 'weight' => 0, + 'filters' => array( + // URL filter. + 'filter_url' => array( + 'weight' => 0, + 'status' => 1, + ), + // HTML filter. + 'filter_html' => array( + 'weight' => 1, + 'status' => 1, + ), + // Line break filter. + 'filter_autop' => array( + 'weight' => 2, + 'status' => 1, + ), + // HTML corrector filter. + 'filter_htmlcorrector' => array( + 'weight' => 10, + 'status' => 1, + ), + ), + ); + $filtered_html_format = (object) $filtered_html_format; + filter_format_save($filtered_html_format); + + $full_html_format = array( + 'name' => 'Full HTML', + 'weight' => 1, + 'filters' => array( + // URL filter. + 'filter_url' => array( + 'weight' => 0, + 'status' => 1, + ), + // Line break filter. + 'filter_autop' => array( + 'weight' => 1, + 'status' => 1, + ), + // HTML corrector filter. + 'filter_htmlcorrector' => array( + 'weight' => 10, + 'status' => 1, + ), + ), + ); + $full_html_format = (object) $full_html_format; + filter_format_save($full_html_format); + + $plain_text_format = array( + 'name' => 'Plain text', + 'weight' => 10, + 'filters' => array( + // Escape all HTML. + 'filter_html_escape' => array( + 'weight' => 0, + 'status' => 1, + ), + // Line break filter. + 'filter_autop' => array( + 'weight' => 1, + 'status' => 1, + ), + ), + ); + $plain_text_format = (object) $plain_text_format; + filter_format_save($plain_text_format); + + // Set the fallback format to plain text. + variable_set('filter_fallback_format', $plain_text_format->format); + + // Enable some standard blocks. + $values = array( + array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'search', + 'delta' => 'form', + 'theme' => 'garland', + 'status' => 1, + 'weight' => -1, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'login', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'navigation', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'management', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 1, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'powered-by', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 10, + 'region' => 'footer', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'help', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'help', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => 'seven', + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'help', + 'theme' => 'seven', + 'status' => 1, + 'weight' => 0, + 'region' => 'help', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'login', + 'theme' => 'seven', + 'status' => 1, + 'weight' => 10, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'new', + 'theme' => 'seven', + 'status' => 1, + 'weight' => 0, + 'region' => 'dashboard_sidebar', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'search', + 'delta' => 'form', + 'theme' => 'seven', + 'status' => 1, + 'weight' => -10, + 'region' => 'dashboard_sidebar', + 'pages' => '', + 'cache' => -1, + ), + ); + $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); + foreach ($values as $record) { + $query->values($record); + } + $query->execute(); + + // Insert default user-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('Page'), + 'base' => 'node_content', + 'description' => st("Use <em>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-specific 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); + } + + // Insert default user-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( + 'rdftype' => array('sioc:Item', 'foaf:Document'), + ), + ), + ); + foreach ($rdf_mappings as $rdf_mapping) { + rdf_mapping_save($rdf_mapping); + } + + // Default 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 page nodes by default. + variable_set('node_submitted_page', FALSE); + + // Enable user picture support and set the default to a square thumbnail option. + variable_set('user_pictures', '1'); + variable_set('user_picture_dimensions', '1024x1024'); + variable_set('user_picture_file_size', '800'); + variable_set('user_picture_style', 'thumbnail'); + + // Create a default vocabulary named "Tags", enabled for the 'article' content type. + $description = st('Use tags to group articles on similar topics into categories.'); + $help = st('Enter a comma-separated list of words to describe your content.'); + $vocabulary = (object) array( + 'name' => 'Tags', + 'description' => $description, + 'machine_name' => 'tags', + 'help' => $help, + + ); + taxonomy_vocabulary_save($vocabulary); + $instance = array( + 'field_name' => 'taxonomy_' . $vocabulary->machine_name, + 'object_type' => 'node', + 'label' => $vocabulary->name, + 'bundle' => 'article', + 'description' => $vocabulary->help, + 'widget' => array( + 'type' => 'taxonomy_autocomplete', + 'weight' => 4, + ), + ); + field_create_instance($instance); + + + // Create an image field named "Image", enabled for the 'article' content type. + // Many of the following values will be defaulted, they're included here as an illustrative examples. + // @see: http://api.drupal.org/api/function/field_create_field/7 + + $field = array( + 'field_name' => 'field_image', + 'type' => 'image', + 'cardinality' => 1, + 'translatable' => TRUE, + 'locked' => FALSE, + 'indexes' => array('fid' => array('fid')), + 'settings' => array( + 'uri_scheme' => 'public', + 'default_image' => FALSE, + ), + 'storage' => array( + 'type' => 'field_sql_storage', + 'settings' => array(), + ), + ); + field_create_field($field); + + + // Many of the following values will be defaulted, they're included here as an illustrative examples. + // @see: http://api.drupal.org/api/function/field_create_instance/7 + $instance = array( + 'field_name' => 'field_image', + 'object_type' => 'node', + 'label' => 'Image', + 'bundle' => 'article', + 'description' => 'Upload an image to go with this article.', + 'required' => FALSE, + + 'settings' => array( + 'file_directory' => 'field/image', + 'file_extensions' => 'png gif jpg jpeg', + 'max_filesize' => '', + 'max_resolution' => '', + 'min_resolution' => '', + 'alt_field' => TRUE, + 'title_field' => '', + ), + + 'widget' => array( + 'type' => 'image_image', + 'settings' => array( + 'progress_indicator' => 'throbber', + 'preview_image_style' => 'thumbnail', + ), + 'weight' => -1, + ), + + 'display' => array( + 'full' => array( + 'label' => 'hidden', + 'type' => 'image__large', + 'settings' => array(), + 'weight' => -1, + ), + 'teaser' => array( + 'label' => 'hidden', + 'type' => 'image_link_content__medium', + 'settings' => array(), + 'weight' => -1, + ), + 'rss' => array( + 'label' => 'hidden', + 'type' => 'image__large', + 'settings' => array(), + 'weight' => -1, + ), + 'search_index' => array( + 'label' => 'hidden', + 'type' => 'image__large', + 'settings' => array(), + 'weight' => -1, + ), + 'search_results' => array( + 'label' => 'hidden', + 'type' => 'image__large', + 'settings' => array(), + 'weight' => -1, + ), + ), + ); + field_create_instance($instance); + + // Enable default permissions for system roles. + $filtered_html_permission = filter_permission_name($filtered_html_format); + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', $filtered_html_permission)); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'post comments without approval', $filtered_html_permission)); + + // Create a default role for site administrators, with all available permissions assigned. + $admin_role = new stdClass(); + $admin_role->name = 'administrator'; + user_role_save($admin_role); + user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission'))); + // Set this as the administrator role. + variable_set('user_admin_role', $admin_role->rid); + + // Update the menu router information. + menu_rebuild(); + + // Enable the admin theme. + db_update('system') + ->fields(array('status' => 1)) + ->condition('type', 'theme') + ->condition('name', 'seven') + ->execute(); + variable_set('admin_theme', 'seven'); + variable_set('node_admin_theme', '1'); +} |