Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/rdf/src/CommonDataConverter.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\rdf; | |
4 | |
5 /** | |
6 * Contains methods for common data conversions. | |
7 */ | |
8 class CommonDataConverter { | |
9 | |
10 /** | |
11 * Provides a passthrough to place unformatted values in content attributes. | |
12 * | |
13 * @param mixed $data | |
14 * The data to be placed in the content attribute. | |
15 * | |
16 * @return mixed | |
17 * Returns the data. | |
18 */ | |
19 public static function rawValue($data) { | |
20 return $data; | |
21 } | |
22 | |
23 /** | |
24 * Converts a date entity field array into an ISO 8601 timestamp string. | |
25 * | |
26 * @param array $data | |
27 * The array containing the 'value' element. | |
28 * | |
29 * @return string | |
30 * Returns the ISO 8601 timestamp. | |
31 */ | |
32 public static function dateIso8601Value($data) { | |
33 return \Drupal::service('date.formatter')->format($data['value'], 'custom', 'c', 'UTC'); | |
34 } | |
35 | |
36 } |