You are here

class MobileDeviceDetectionAttributes in Mobile Device Detection 8.2

Same name and namespace in other branches
  1. 8.3 src/Object/MobileDeviceDetectionAttributes.php \Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes
  2. 8 src/Object/MobileDeviceDetectionAttributes.php \Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes

MobileDeviceDetectionAttributes class.

Hierarchy

Expanded class hierarchy of MobileDeviceDetectionAttributes

1 string reference to 'MobileDeviceDetectionAttributes'
mobile_device_detection.services.yml in ./mobile_device_detection.services.yml
mobile_device_detection.services.yml
1 service uses MobileDeviceDetectionAttributes
object.mdd.properties in ./mobile_device_detection.services.yml
Drupal\mobile_device_detection\Object\MobileDeviceDetectionAttributes

File

src/Object/MobileDeviceDetectionAttributes.php, line 10

Namespace

Drupal\mobile_device_detection\Object
View source
class MobileDeviceDetectionAttributes {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members