You are here

protected function ServicesClientFieldFormatter::formatEmptyValue in Services Client 7.2

Retrieve empty value formatting by configuration.

Return value

array|NULL Formatted empty value.

1 call to ServicesClientFieldFormatter::formatEmptyValue()
ServicesClientFieldFormatter::format in include/mapping.inc
Format source value to destination.
1 method overrides ServicesClientFieldFormatter::formatEmptyValue()
ServicesClientFieldD6Formatter::formatEmptyValue in include/mapping.inc
Retrieve empty value formatting by configuration.

File

include/mapping.inc, line 666

Class

ServicesClientFieldFormatter

Code

protected function formatEmptyValue() {
  if ($this->config['empty'] == 'no_field') {
    return NULL;
  }
  elseif ($this->config['empty'] == 'null_field') {
    return array(
      'key' => $this->config['field'],
      'value' => array(
        $this->config['language'] => array(),
      ),
    );
  }
  elseif ($this->config['empty'] == 'null_property') {
    return array(
      'key' => $this->config['field'],
      'value' => NULL,
    );
  }
  elseif ($this->config['empty'] == 'default_value') {
    return array(
      'key' => $this->config['field'],
      'value' => array(
        $this->config['language'] => array(
          array(
            $this->config['property'] => $this->config['default_value'],
          ),
        ),
      ),
    );
  }
}