entityreference_plugin_row_fields.inc 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Handler for entityreference_plugin_row_fields.
  5. */
  6. class entityreference_plugin_row_fields extends views_plugin_row_fields {
  7. function option_definition() {
  8. $options = parent::option_definition();
  9. $options['separator'] = array('default' => '-');
  10. return $options;
  11. }
  12. /**
  13. * Provide a form for setting options.
  14. */
  15. function options_form(&$form, &$form_state) {
  16. parent::options_form($form, $form_state);
  17. // Expand the description of the 'Inline field' checkboxes.
  18. $form['inline']['#description'] .= '<br />' . t("<strong>Note:</strong> In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here." );
  19. }
  20. function pre_render($row) {
  21. // Force all fields to be inline by default.
  22. if (empty($this->options['inline'])) {
  23. $fields = $this->view->get_items('field', $this->display->id);
  24. $this->options['inline'] = drupal_map_assoc(array_keys($fields));
  25. }
  26. return parent::pre_render($row);
  27. }
  28. }