@chillin411
Drupal Install Profiles
The coolest thing you're not customizing on Drupal... yet.
@chillin411
What is an install profile?
• Set of instructions that Drupal runs during the install
process
• Easy way to EN...
@chillin411
Why should I use them?
• Extremely easy to write
• Can start small and add to it as time goes by
• There's no ...
@chillin411
Cool things you can do:
• Enable modules at install
• Set an administration theme
• Add a new input format and...
@chillin411
Drupal 6 Install Profiles
• Composed of one file.profile
• Several PHP hooks
o hook_profile_modules()
o hook_p...
@chillin411
Drupal 7 Install Profiles
• Consists of 3 files
o profile.info
 Similar to a module .info file (install modul...
@chillin411
Cool thing #1 - Enabling Modules
• D6 - hook_profile_modules()
o return array('views', 'views_ui', 'token');
•...
@chillin411
Cool thing #2 - Default Themes
• variable_set('admin_theme', 'Rubik');
o D6 - Put in hook_profile_tasks
o D7 -...
@chillin411
Cool thing #3 - Create Admin Role
• D6 - hook_profile_tasks()
o $form_state = array();
$form_state['values']['...
@chillin411
How to get started?
• In Drupal 6, copy the /profiles/default folder, rename the
folder, .profile and function...
@chillin411
One trick on the variables table
• Variables in the variable table are serialized.
o a:3:{i:0;s:4:"node";i:1;s...
Thanks!
@chillin411
Upcoming SlideShare
Loading in …5
×

Drupal Install Profiles

2,091 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,091
On SlideShare
0
From Embeds
0
Number of Embeds
176
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Drupal Install Profiles

  1. 1. @chillin411 Drupal Install Profiles The coolest thing you're not customizing on Drupal... yet.
  2. 2. @chillin411 What is an install profile? • Set of instructions that Drupal runs during the install process • Easy way to ENABLE (compare to DOWNLOAD using Drush Make) modules at install. • Can do practically anything using PHP
  3. 3. @chillin411 Why should I use them? • Extremely easy to write • Can start small and add to it as time goes by • There's no reason to do the same setup tasks over and over. • Does the 2nd half of the work that you do with Drush Make.
  4. 4. @chillin411 Cool things you can do: • Enable modules at install • Set an administration theme • Add a new input format and configure it to use CKEditor • Add users, nodes, or roles • Create default content • Anything you can do with PHP
  5. 5. @chillin411 Drupal 6 Install Profiles • Composed of one file.profile • Several PHP hooks o hook_profile_modules() o hook_profile_details() o hook_profile_task_list() o hook_profile_tasks() o hook_form_alter()
  6. 6. @chillin411 Drupal 7 Install Profiles • Consists of 3 files o profile.info  Similar to a module .info file (install modules here) o profile.install  Similar to a module's .install file (most of your editing will go here) o profile.profile  Similar to a module's .module file (form_alters, etc)
  7. 7. @chillin411 Cool thing #1 - Enabling Modules • D6 - hook_profile_modules() o return array('views', 'views_ui', 'token'); • D7 - profile.info o dependencies[] = views dependencies[] = views_ui dependencies[] = token
  8. 8. @chillin411 Cool thing #2 - Default Themes • variable_set('admin_theme', 'Rubik'); o D6 - Put in hook_profile_tasks o D7 - Put in hook_install • variable_set('theme_default', 'Bartik');
  9. 9. @chillin411 Cool thing #3 - Create Admin Role • D6 - hook_profile_tasks() o $form_state = array(); $form_state['values']['name'] = 'Administrator'; $form_state['values']['op'] = t('Create admin role'); drupal_execute('user_admin_new_role', $form_state); • Alternatively, you can use a db_query, but be careful about this - notice lack of INTO, and lack of rid key. o db_query("INSERT {role} (name) VALUES ( 'Administrator')");
  10. 10. @chillin411 How to get started? • In Drupal 6, copy the /profiles/default folder, rename the folder, .profile and function hook names to match your profile. • In Drupal 7, use the /profiles/standard instead of profiles/minimal (more stuff there to work with) • If you're enabling modules, make sure to have them already downloaded. Drush make is awesome for this. • Start editing, and looking at variables table.
  11. 11. @chillin411 One trick on the variables table • Variables in the variable table are serialized. o a:3:{i:0;s:4:"node";i:1;s:8:"taxonomy";i:2;s:4:"user";} o array(0 => "node", 1 => "taxonomy", 2 => "user") • So, if you want to add this to the variables table (pathauto does this automatically, just an example) o $array_pathauto_modulelist = array(0 => "node", 1 => "taxonomy", 2 => "user"); o variable_set('pathauto_modulelist', $array_pathauto_modulelist);
  12. 12. Thanks! @chillin411

×