I'd like to see packages have a set way of handling the import both custom Content Types based on CCK and Views.
I'm recommending a system where two new directories are provided, Content/ and Views/. In each of these the individual exports of the CCK or Views that can be provided by the corresponding export modules would be pasted into a file name.inc. Then packgr could just run through all the *.inc files in the directory and import them.
Perhaps some pretty UI option would allow a select box to choose which view and content types to import, but then you'd step into questions of resolving dependency and it could get ugly so I'm suggesting that should be for another day. :-)
Something similar to this is done in the phpedu_profile install profile on CCK only. I've stolen it for a profile I'm working on for churches. The code may be helpful:
/**
* Load all the content type definitions in content_types/*.inc.
**/
function church_profile_create_content_types() {
$path = drupal_get_path('profile', 'church_profile') .'/content_types';
$calendar_options = array();
if ($handle = opendir($path)) {
while ($file = readdir($handle)) {
if (preg_match('@(.*)\.inc$@', $file)) {
$file_path = $path .'/'. $file;
$type_name = str_replace('.inc', '', $file);
$existing_type_name = ($type_name == 'profile') ? $type_name : '';
install_content_copy_import_from_file($file_path, $existing_type_name);
}
}
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | packgr_install_profile_api.patch | 1.25 KB | futuresoon |
| #1 | packages.tar_.gz | 6.43 KB | futuresoon |
Comments
Comment #1
futuresoon commentedhere are some packages i made (mostly) using boris mann's awesome install_profile_api
i hope this spurs other people to start using and developing this awesome install profile
thanks, mikey_p!
[edit:] oh yeah, i forgot to advertise what's in here---
these packages are
1) a really simple "content types" checklist UI that checks profiles/packgr/content_types for dorby.txt and this.txt (some weird content type names I made up to test some things)----these .txt files (i guess they should be .inc files) are just dumps from CCK export (with an opening <?php tag)
2) a "basic" package with some stuff i do every drupal site (like admin_menu for one thing)
3) a port of the cck datefield test profile to packgr (hopefully we can consolidate activities within a framework of packgr + install_profile_api by porting other install profiles? )
4) a development install profile that i use with
-drush command-line package management from drupal's end
-coder
-devel
-php input format
-and what-not
(Would be cool to port the actual devel install profile too)
5) for the menu.inc thing, i forgot to stop it from @requiring an external file (packgr/profiles/menus.inc) on two different lines
basically, it's this simple UI that if you cut and paste:
$menusd[0]['paththing']='admin/build/block';
$menusd[0]['title']='thepackagerthingie';
$menusd[1]['paththing']='admin/build';
$menusd[1]['title']='thepackage';
it should create two menu items in the primary links, just so you could quickly create primary links on a site you were rapidly prototyping, without having to input them every time you build the site (i like using install profiles, yum!)
Comment #2
flickerfly commentedCool so you also have the CCK import thing figured out. Have you done any auto-import of views type of thing that is similar?
Comment #3
futuresoon commentedWell, right now, if I need a View, I make it, put it in a module that has a mymodulename.views_default.inc file that'll override core views for example. Something like this http://groups.drupal.org/node/17236
Then I put that module into profiles/packgr/modules (Drupal checks there) and just list it as a required module.