/[drupal]/contributions/sandbox/alex_b/ag_devel/ag_devel.profile
ViewVC logotype

Contents of /contributions/sandbox/alex_b/ag_devel/ag_devel.profile

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Mon Jul 21 16:19:07 2008 UTC (16 months ago) by alexb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
File MIME type: text/x-php
Remove my email address. Dumb.
1 <?php
2 // $Id: ag_devel.profile,v 1.2 2008/07/21 15:52:24 alexb Exp $
3
4 define('MAIN_MAIL', '');
5 define('MAIN_ACCOUNT_NAME', 'admin');
6
7 /**
8 * Return an array of the modules to be enabled when this profile is installed.
9 *
10 * @return
11 * An array of modules to enable.
12 */
13 function ag_devel_profile_modules() {
14 return array(
15 'color', 'comment', 'help', 'menu', 'taxonomy', 'dblog',
16 'aggregator', 'syndication_parser',
17 'devel', 'simpletest',
18 );
19 }
20
21 /**
22 * Return a description of the profile for the initial installation screen.
23 *
24 * @return
25 * An array with keys 'name' and 'description' describing this profile,
26 * and optional 'language' to override the language selection for
27 * language-specific profiles.
28 */
29 function ag_devel_profile_details() {
30 return array(
31 'name' => 'Aggregator development',
32 'description' => 'Development setup for aggregator.'
33 );
34 }
35
36 /**
37 * Return a list of tasks that this profile supports.
38 *
39 * @return
40 * A keyed array of tasks the profile will perform during
41 * the final stage. The keys of the array will be used internally,
42 * while the values will be displayed to the user in the installer
43 * task list.
44 */
45 function ag_devel_profile_task_list() {
46 }
47
48 /**
49 * Perform any final installation tasks for this profile.
50 *
51 * The installer goes through the profile-select -> locale-select
52 * -> requirements -> database -> profile-install-batch
53 * -> locale-initial-batch -> configure -> locale-remaining-batch
54 * -> finished -> done tasks, in this order, if you don't implement
55 * this function in your profile.
56 *
57 * If this function is implemented, you can have any number of
58 * custom tasks to perform after 'configure', implementing a state
59 * machine here to walk the user through those tasks. First time,
60 * this function gets called with $task set to 'profile', and you
61 * can advance to further tasks by setting $task to your tasks'
62 * identifiers, used as array keys in the hook_profile_task_list()
63 * above. You must avoid the reserved tasks listed in
64 * install_reserved_tasks(). If you implement your custom tasks,
65 * this function will get called in every HTTP request (for form
66 * processing, printing your information screens and so on) until
67 * you advance to the 'profile-finished' task, with which you
68 * hand control back to the installer. Each custom page you
69 * return needs to provide a way to continue, such as a form
70 * submission or a link. You should also set custom page titles.
71 *
72 * You should define the list of custom tasks you implement by
73 * returning an array of them in hook_profile_task_list(), as these
74 * show up in the list of tasks on the installer user interface.
75 *
76 * Remember that the user will be able to reload the pages multiple
77 * times, so you might want to use variable_set() and variable_get()
78 * to remember your data and control further processing, if $task
79 * is insufficient. Should a profile want to display a form here,
80 * it can; the form should set '#redirect' to FALSE, and rely on
81 * an action in the submit handler, such as variable_set(), to
82 * detect submission and proceed to further tasks. See the configuration
83 * form handling code in install_tasks() for an example.
84 *
85 * Important: Any temporary variables should be removed using
86 * variable_del() before advancing to the 'profile-finished' phase.
87 *
88 * @param $task
89 * The current $task of the install system. When hook_profile_tasks()
90 * is first called, this is 'profile'.
91 * @param $url
92 * Complete URL to be used for a link or form action on a custom page,
93 * if providing any, to allow the user to proceed with the installation.
94 *
95 * @return
96 * An optional HTML string to display to the user. Only used if you
97 * modify the $task, otherwise discarded.
98 */
99 function ag_devel_profile_tasks(&$task, $url) {
100
101 // Insert default user-defined node types into the database. For a complete
102 // list of available node type attributes, refer to the node type API
103 // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
104 $types = array(
105 array(
106 'type' => 'page',
107 'name' => st('Page'),
108 'module' => 'node',
109 'description' => st("A <em>page</em>, similar in form to an <em>article</em>, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site's initial home page."),
110 'custom' => TRUE,
111 'modified' => TRUE,
112 'locked' => FALSE,
113 'help' => '',
114 'min_word_count' => '',
115 ),
116 array(
117 'type' => 'article',
118 'name' => st('Article'),
119 'module' => 'node',
120 'description' => st("An <em>article</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with an <em>article</em> entry. By default, an <em>article</em> entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
121 'custom' => TRUE,
122 'modified' => TRUE,
123 'locked' => FALSE,
124 'help' => '',
125 'min_word_count' => '',
126 ),
127 );
128
129 foreach ($types as $type) {
130 $type = (object) _node_type_set_defaults($type);
131 node_type_save($type);
132 }
133
134 // Default page to not be promoted and have comments disabled.
135 variable_set('node_options_page', array('status'));
136 variable_set('comment_page', COMMENT_NODE_DISABLED);
137
138 // Don't display date and author information for page nodes by default.
139 $theme_settings = variable_get('theme_settings', array());
140 $theme_settings['toggle_node_info_page'] = FALSE;
141 variable_set('theme_settings', $theme_settings);
142
143 // Create a default vocabulary named "Tags", enabled for the 'article' content type.
144 $description = st('Use tags to group articles on similar topics into categories.');
145 $help = st('Enter a comma-separated list of words.');
146 db_query("INSERT INTO {vocabulary} VALUES (NULL, 'Tags', '%s', '%s', 0, 0, 0, 0, 1, 'taxonomy', 0)", $description, $help);
147 $vid = db_last_insert_id('vocabulary', 'vid');
148 db_query("INSERT INTO {vocabulary_node_types} VALUES (%d, 'article')", $vid);
149
150 // Update the menu router information.
151 menu_rebuild();
152 }
153
154 /**
155 * Implementation of hook_form_alter().
156 *
157 * Allows the profile to alter the site-configuration form. This is
158 * called through custom invocation, so $form_state is not populated.
159 */
160 function ag_devel_form_alter(&$form, $form_state, $form_id) {
161 if ($form_id == 'install_configure') {
162 // Set defaults.
163 $form['site_information']['site_name']['#default_value'] = 'Aggregator';
164 $form['site_information']['site_mail']['#default_value'] = MAIN_MAIL;
165 $form['admin_account']['account']['name']['#default_value'] = MAIN_ACCOUNT_NAME;
166 $form['admin_account']['account']['mail']['#default_value'] = MAIN_MAIL;
167 }
168 }

  ViewVC Help
Powered by ViewVC 1.1.2