deal with complex variables in features

Hello,

How you usually(or not usually) deal with complex variable in features? :)
Let's say my feature holds some content type which should not publish author/date info. To make this happen I have to change theme_settings[toggle_node_info_MY_CONTENT_TYPE] but feature can deal with whole theme_settings only and therefore any new content type will make it not sensible overridden.

So far I am thinking to use install hook instead of strongarm for such changes...

Thanks.

Comments

Strongarm can not deal with

mrfelton's picture

Strongarm can not deal with partial variables like that. I use features for most things but like you I ran into this problem.

This is how I did it for the vertical_tabs_config variable, which stores the settings for every single content type within the one variable...

<?php
/**
* Update the vertical tabs setting for mynodetype content type.
*/
function mymodule_update_6001() {
 
// set up vertical tabs
 
$vertial_tabs_config variable_get('vertical_tabs_forms', array());
 
$vertial_tabs_config['mynodetype_node_form'] = _mymodule_mynodetype_vget_vertical_tabs_forms();
 
variable_set('vertical_tabs_forms', $vertial_tabs_config);
}

/*
* Helper functions to set the value of vertical_tabs_forms.
*/
function _mymodule_mynodetype_vget_vertical_tabs_forms() {
  return array (
   
'revision_information' => 'revision_information',
   
'author' => 'author',
   
'options' => 'options',
   
'book' => 'book',
   
'comment_settings' => 'comment_settings',
   
'menu' => 'menu',
   
'path' => 'path',
   
'path_redirect' => 'path_redirect',
   
'print' => 'print',
   
'custom_breadcrumbs' => 'custom_breadcrumbs',
   
'xmlsitemap' => 'xmlsitemap',
   
'search_block_set' => 'search_block_set',
   
'taxonomy' => 0,
   
'nodewords' => 0,
   
'group_statistics' => 0,
  );
}
?>

So, it's not really integrating with features in any kind of way, but it does allow me to move partial variable settings between machines.

ps. I used drush --pipe vget vertical_tabs_forms to dump the value of the variable and then just copy/pasted it into my function.

Packaging & Deployment

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week