You are here

public function DoubleFieldField::__construct in Double Field 7.2

Constructor for DoubleFieldInctance.

File

tests/double_field_field.inc, line 19
The file contains a class that assists to test Double Field field settings.

Class

DoubleFieldField
Helper class to test Double Field field settings.

Code

public function __construct($field_type, $settings = FALSE) {

  // The order of the elements compared in
  // which order they were written in the list().
  list($this->subfields['second'], $this->subfields['first']) = array_reverse(explode('_&_', $field_type));
  $sizes = array(
    'tiny',
    'small',
    'medium',
    'normal',
    'big',
  );
  foreach ($this->subfields as $index => $subfield_type) {
    shuffle($sizes);
    $this->settings[$index] = array(
      'type' => $subfield_type,
      'maxlength' => mt_rand(1, 10000),
      'size' => $sizes[0],
      'precision' => mt_rand(10, 32),
      'scale' => mt_rand(0, 10),
    );
  }
}