--- views/filefield_handler_field_data.inc 8 Jan 2010 22:38:40 -0000 1.2 +++ views/filefield_handler_field_data.inc 8 Dec 2010 04:52:23 -0000 @@ -18,27 +18,33 @@ function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); + $options = array(); + $info = filefield_data_info(); + foreach ($info as $key => $data) { + $options[$key] = $data['title'] . ' (' . $data['module'] .')'; + } + $form['data_key'] = array( '#title' => t('Data key'), '#type' => 'radios', - // TODO: Pull these values from the modules that extend FileField. - '#options' => drupal_map_assoc(array('description', 'title', 'alt')), + '#options' => $options, '#required' => TRUE, '#default_value' => $this->options['data_key'], - '#description' => t('The data column may (or may not) contain any of the following data. Select the data that should be output for this field.'), + '#description' => t('The data column may contain only a few or none any of these data options. The name of the module that provides the data is shown in parathesis.'), '#weight' => 4, ); } function admin_summary() { - // Display the data to be displayed - return $this->options['data_key']; + // Display the data to be displayed. + $info = filefield_data_info(); + return isset($info[$this->options['data_key']]['title']) ? $info[$this->options['data_key']]['title'] : $this->options['data_key']; } function render($values) { $values = drupal_clone($values); // Prevent affecting the original. $data = unserialize($values->{$this->field_alias}); - $values->{$this->field_alias} = $data[$this->options['data_key']]; + $values->{$this->field_alias} = filefield_data_value($this->options['data_key'], $data[$this->options['data_key']]); return parent::render($values); }