You are here

public function SettingTrait::__get in Fasttoggle 8.2

Retrieve the object type that can be modified by this setting.

Return value

string The machine name for the object type being modified by this setting.

File

src/Plugin/Setting/SettingTrait.php, line 53
Fasttoggle Object List of Values Setting

Class

SettingTrait
Abstract interface for settings.

Namespace

Drupal\fasttoggle\Plugin\Setting

Code

public function __get($name) {

  // Simple member
  if (isset($this->{$name})) {
    return $this->{$name};
  }

  // Annotation
  $definition = $this
    ->getPluginDefinition();
  if (isset($definition[$name])) {
    return $definition[$name];
  }

  // Specific getter function
  $functionName = "get_{$name}";
  if (is_callable([
    $this,
    $functionName,
  ])) {
    return $this
      ->{$functionName}();
  }

  // Unmatched
  $trace = debug_backtrace();
  trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_ERROR);
  return NULL;
}