--- views_handler_field_field.inc 2012-04-16 11:43:38.000000000 +0200 +++ views_handler_field_field.inc 2012-05-31 18:05:20.119843136 +0200 @@ -313,6 +313,11 @@ $options['group_rows'] = array( 'default' => TRUE, ); + + // Option to randomize the result displayed + $options['randomize'] = array( + 'default' => FALSE, + ); // If we know the exact number of allowed values, then that can be // the default. Otherwise, default to 'all'. $options['delta_limit'] = array( @@ -523,6 +528,15 @@ '#dependency' => array('edit-options-group-rows' => array(TRUE)), '#fieldset' => 'multiple_field_settings', ); + + $form['randomize'] = array( + '#title' => t('Randomize'), + '#type' => 'checkbox', + '#default_value' => $this->options['randomize'], + '#fieldset' => 'multiple_field_settings', + '#dependency' => array('edit-options-group-rows' => array(TRUE)), + '#description' => t('Randomize the display of this multiple field.'), + ); } /** @@ -700,6 +714,11 @@ return array(); } + // Randomize the order of the values. + if ($this->options['randomize']) { + shuffle($entity->{$this->definition['field_name']}[$langcode]); + } + // We are supposed to show only certain deltas. if ($this->limit_values && !empty($entity->{$this->definition['field_name']})) { $all_values = !empty($entity->{$this->definition['field_name']}[$langcode]) ? $entity->{$this->definition['field_name']}[$langcode] : array();