You are here

public function DoubleFieldField::getSettingsFormInput in Double Field 7.2

Return input array for post submission.

File

tests/double_field_field.inc, line 138
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 getSettingsFormInput() {
  $input = array();
  foreach (array(
    'first',
    'second',
  ) as $subfield) {
    $input["field[settings][{$subfield}][type]"] = $this->settings[$subfield]['type'];
    switch ($this->settings[$subfield]['type']) {
      case 'varchar':
        $input["field[settings][{$subfield}][maxlength]"] = $this->settings[$subfield]['maxlength'];
        break;
      case 'int':
      case 'float':
        $input["field[settings][{$subfield}][size]"] = $this->settings[$subfield]['size'];
        break;
      case 'decimal':
        $input["field[settings][{$subfield}][precision]"] = $this->settings[$subfield]['precision'];
        $input["field[settings][{$subfield}][scale]"] = $this->settings[$subfield]['scale'];
        break;
    }
  }
  return $input;
}