getSettings()) { foreach ($entity->getSettings() as $setting) { if ($setting->getName() == $name) { return $setting; } } } return null; } public function getSettingValue(EntityInterface $entity, string $name): ?string { $setting = $this->getSetting($entity, $name); if($setting) { return $this->getValue($setting); } return null; } public function getValue(SettingInterface $setting): ?string { if ($setting->getText()) { return $setting->getText(); } elseif ($setting->getDate()) { return $setting->getDate(); } elseif ($setting->getFile()) { return $setting->getFile(); } return null; } }