public function GranularityService::includeGranularityElement in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 src/Service/GranularityService.php \Drupal\duration_field\Service\GranularityService::includeGranularityElement()
Test if the given granularity element should be included.
Inclusion is determined based on the given granularity string.
Parameters
string $granularityElement: The granularity element to test for. Values can be:
- y (years)
- m (months)
- d (days)
- h (hours)
- i (minutes)
- s (seconds)
string $granularityString: The granularity string to test against.
Return value
bool TRUE if the given granularity should be inclued, FALSE otherwise.
Overrides GranularityServiceInterface::includeGranularityElement
File
- src/
Service/ GranularityService.php, line 57
Class
Namespace
Drupal\duration_field\ServiceCode
public function includeGranularityElement($granularityElement, $granularityString) {
$granularities = $this
->convertGranularityStringToGranularityArray($granularityString);
return $granularities[$granularityElement];
}