You are here

public function MobileDeviceDetectionConditionPlugin::summary in Mobile Device Detection 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/Condition/MobileDeviceDetectionConditionPlugin.php \Drupal\mobile_device_detection\Plugin\Condition\MobileDeviceDetectionConditionPlugin::summary()

Provides a human readable summary of the condition's configuration.

Overrides ConditionInterface::summary

File

src/Plugin/Condition/MobileDeviceDetectionConditionPlugin.php, line 58

Class

MobileDeviceDetectionConditionPlugin
This main class which add ability to determine device.

Namespace

Drupal\mobile_device_detection\Plugin\Condition

Code

public function summary() {
  $devices = $this->configuration['devices'];
  if (count($devices) > 1) {
    $devices = implode(', ', $devices);
  }
  else {
    $devices = reset($devices);
  }
  if (!empty($this->configuration['negate'])) {
    return $this
      ->t('The device is not @devices', [
      '@devices' => $devices,
    ]);
  }
  else {
    return $this
      ->t('The device is @devices', [
      '@devices' => $devices,
    ]);
  }
}