public function Drupal7::formatProperty in Realistic Dummy Content 7.2
Same name and namespace in other branches
- 8.2 api/src/Framework/Drupal7.php \Drupal\realistic_dummy_content_api\Framework\Drupal7::formatProperty()
File
- api/
src/ Framework/ Drupal7.php, line 272
Class
- Drupal7
- Drupal 7-specific code.
Namespace
Drupal\realistic_dummy_content_api\FrameworkCode
public function formatProperty($type, $value, $options = array()) {
switch ($type) {
case 'file':
return array(
LANGUAGE_NONE => array(
(array) $value,
),
);
case 'value':
case 'tid':
return array(
LANGUAGE_NONE => array(
array_merge($options, array(
$type => $value,
)),
),
);
case 'text_with_summary':
return array(
LANGUAGE_NONE => array(
array_merge($options, array(
'value' => $value,
)),
),
);
default:
throw new \Exception('Unknown property type ' . $type);
}
}