You are here

public function views_merge_rows_plugin_display_extender::get_options in Views Merge Rows 7

Returns configuration for row merging.

Only returns the configuration for the fields present in the view. If a new field was added to the view, the default configuration for this field is returned.

Return value

array Configuration for row merging.

2 calls to views_merge_rows_plugin_display_extender::get_options()
views_merge_rows_plugin_display_extender::options_summary in ./views_merge_rows_plugin_display_extender.inc
Provide the default summary for options in the views UI.
views_merge_rows_plugin_display_extender::views_merge_rows_options_form in ./views_merge_rows_plugin_display_extender.inc
Provide a form to edit options for this plugin.

File

./views_merge_rows_plugin_display_extender.inc, line 32
Contains the class to extend views display with rows merge functionality.

Class

views_merge_rows_plugin_display_extender
The plugin that merges rows with the same content in the specified fields.

Code

public function get_options() {
  if ($this->display->display->handler
    ->uses_fields()) {
    $options = array();
    $options['merge_rows'] = $this->display
      ->get_option('merge_rows');
    if (empty($options['merge_rows'])) {
      $options['merge_rows'] = FALSE;
    }
    $options['field_config'] = array();
    $field_config = $this->display
      ->get_option('field_config');
    $fields = $this->display->display->handler
      ->get_option('fields');
    foreach ($fields as $field => $info) {
      if (isset($field_config[$field])) {
        $options['field_config'][$field] = $field_config[$field];
      }
      else {
        $options['field_config'][$field] = array(
          'merge_option' => 'merge_unique',
          'separator' => ', ',
        );
      }
    }
  }
  else {
    $options['merge_rows'] = FALSE;
    $options['field_config'] = array();
  }
  return $options;
}