additional_fields = array(); $this->additional_fields['nid'] = 'nid'; $this->additional_fields['format'] = array('table' => 'node_revisions', 'field' => 'format'); $this->additional_fields['uid'] = 'uid'; $this->additional_fields['type'] = 'type'; } function init(&$view, $options) { parent::init($view, $options); $this->options += array( 'release_type' => $this->radios_get_default($this->get_type_options('release')), 'table_type' => $this->radios_get_default($this->get_type_options('table')), 'first_column_title' => '', ); } /** * Helper function that returns an array of possible types. * * @param $type * Indicates what type of options should be returned. Possible * values are 'release' to get release types or 'table' to get * release table types. * @return * An array of possible types. */ function get_type_options($type){ $types = array( 'release' => array( 'default' => 'official', 'options' => array( 'official' => array( 'name' => t('Official'), 'default_title' => t('Official releases'), ), 'snapshot' => array( 'name' => t('Snapshot'), 'default_title' => t('Snapshot releases'), ), 'all' => array( 'name' => t('All'), 'default_title' => t('Version'), ), ), ), 'table' => array( 'default' => 'supported', 'options' => array( 'recommended' => array( 'name' => t('Recommended'), ), 'supported' => array( 'name' => t('Supported'), ), 'all' => array( 'name' => t('All'), ), ), ), ); return (isset($types[$type])) ? $types[$type] : array(); } /** * Get the default option. * * @param $types * An array of types returned by $this::get_type_options(). * @return * A string indicating the key of $types that should be the default option. */ function radios_get_default($types) { return isset($types['default']) ? $types['default'] : ''; } /** * Get all possible options. * * @param $types * An array of types returned by $this::get_type_options(). * @return * An array of possible options. */ function radios_get_options($types) { $options = array(); foreach ($types['options'] as $key => $info) { $options[$key] = $info['name']; } return $options; } /** * Default options form that provides the label widget that all fields * should have. */ function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['table_type'] = array( '#type' => 'radios', '#prefix' => '