2011-11-17 77 views
0

如何在我的Drupal安裝配置文件中更改使用的顏色配置文件?我已經安裝了colors模塊,我可以在Appearance - Settings - *theme*下配置我的顏色模式,從而產生具有所有顏色值的$info陣列。但是我怎樣才能將它放置在我的安裝配置文件中,以便默認安裝它?在Drupal安裝配置文件中更改顏色模式

我在我的安裝配置文件中添加了一個任務,並將其鏈接到此功能。但顯然,有一些缺失...

$tasks['_create_color']['display_name'] = 'Set the typical color on each platform'; 
$tasks['_create_color']['display'] = 0; 

function _create_color() { 
    $info = array(
    'schemes' => array(
    'default' => array(
     'title' => t('Blue Lagoon (default)'), 
     'colors' => array(
     'top' => '#97279b', 
     'bottom' => '#97279b', 
     'footer' => '#97279b', 
     'link' => '#97279b', 
    ) 
    ))); 
} 

任何人的建議嗎?

回答

1

我發現自己是一個完美的功能來改變使用的顏色配置文件!

function _create_color() { 
    $theme = 'bartik'; 
    $scheme = 'firehouse'; 

    $fform = array(); 
    $fform_state = array(); 

    $fform_state['build_info']['args'][0] = $theme; 
    $fform = system_theme_settings($fform, $fform_state, $theme); 

    color_form_system_theme_settings_alter($fform, $fform_state); 

    $fform_state['values']['theme'] = $theme; 
    $fform_state['values']['info'] = color_get_info($theme); 
    $fform_state['values']['palette'] = $fform_state['values']['info']['schemes'][$scheme]['colors']; 
    $fform_state['values']['scheme'] = $scheme; 

    color_scheme_form_submit($fform, $fform_state); 
} 

在安裝配置文件中的任務中放置這個技巧。