You are here

public function MobileDeviceDetectionAttributes::get in Mobile Device Detection 8.3

Same name and namespace in other branches
  1. 8 src/Object/MobileDeviceDetectionAttributes.php \Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes::get()
  2. 8.2 src/Object/MobileDeviceDetectionAttributes.php \Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes::get()

File

src/Object/MobileDeviceDetectionAttributes.php, line 15

Class

MobileDeviceDetectionAttributes
MobileDeviceDetectionAttributes class.

Namespace

Drupal\mobile_device_detection\Object

Code

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;
}