public function MobileDeviceDetectionAttributes::get in Mobile Device Detection 8
Same name and namespace in other branches
- 8.3 src/Object/MobileDeviceDetectionAttributes.php \Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes::get()
- 8.2 src/Object/MobileDeviceDetectionAttributes.php \Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes::get()
File
- src/
Object/ MobileDeviceDetectionAttributes.php, line 12
Class
Namespace
Drupal\mobile_device_detection\ObjectCode
public function get($attribute = null) {
$file = __DIR__ . '/../../config/attributes/attributes.yml';
if (!file_exists($file)) {
return false;
}
$attributes = Yaml::parse(file_get_contents($file))['attributes'];
if (!is_null($attribute)) {
return $attributes[$attribute];
}
return $attributes;
}