You are here

public function Job::getSetting in Translation Management Tool 8

Retrieves a setting value from the job settings.

Pulls the default values (if defined) from the plugin controller.

Parameters

string $name: The name of the setting.

Return value

string The setting value or $default if the setting value is not set. Returns NULL if the setting does not exist at all.

Overrides JobInterface::getSetting

File

src/Entity/Job.php, line 481

Class

Job
Entity class for the tmgmt_job entity.

Namespace

Drupal\tmgmt\Entity

Code

public function getSetting($name) {
  if (isset($this->settings->{$name})) {
    return $this->settings->{$name};
  }

  // The translator might provide default settings.
  if ($this
    ->hasTranslator()) {
    if (($setting = $this
      ->getTranslator()
      ->getSetting($name)) !== NULL) {
      return $setting;
    }
    $defaults = $this
      ->getTranslatorPlugin()
      ->defaultSettings();
    if (isset($defaults[$name])) {
      return $defaults[$name];
    }
  }
}