array( ), ); } /** * Implementation of hook_features_export_options * * We allow atm only module related variables * * @return array of key/value pairs */ function variable_features_export_options() { return module_list(); } /** * Implementation of hook_features_export(). */ function variable_features_export($data, &$export, $module_name = '') { $export['features']['variable']=_variable_fetch_list($module_name); $pipe = array(); return $pipe; } /** * Implementation of hook_features_export_render(). */ function variable_features_export_render($module = '', $data) { $code = array(); $code[] = ' $variables = array();'; $code[] = ''; $variables=_variable_fetch_list(); foreach ($variables as $name => $value) { if (in_array($name, $data)) { $code[] = ' $variables["'. $name . '"]= ' . features_var_export($value, ' ') . ';'; } } $code[] = ' return $variables;'; $code = implode("\n", $code); return array('variable_default_values' => $code); } /** * Implementation of hook_features_revert(). */ function variable_features_revert($module = NULL) { // ??? return TRUE; } /** * Implementation of hook_features_rebuild(). */ function variable_features_rebuild() { $defaults = module_invoke_all('filter_default_formats'); foreach ($defaults as $format) { // _filter_features_update($format, FALSE); } } function _variable_fetch_list($module='') { $list=array(); $sql = "SELECT name, value FROM variables"; if ($module_name) { $sql .= " WHERE name LIKE '$module_name%'"; } $result = db_query($sql); while ($record = db_fetch_array($result)) { $list[$record['name']] = unserialize($record['value']); } return $list; }