common\ModulesSettings::get PHP Method

get() public method

Get a module setting
public get ( string $module, string $key, mixed $defaultValue = null ) : mixed
$module string The module wherefore a setting has to be retrieved.
$key string The name of the setting to be retrieved.
$defaultValue mixed A fallback value
return mixed
    public function get($module, $key, $defaultValue = null)
    {
        $settings = $this->getSettings();
        if (isset($settings[$module][$key])) {
            return $settings[$module][$key];
        }
        return $defaultValue;
    }

Usage Example

Example #1
0
 /**
  * Execute the command.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @throws Exception
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $this->formatter = new SymfonyStyle($input, $output);
     if (!$this->multiLanguageIsEnabled) {
         $this->formatter->error(['site.multilanguage should be set to true in parameters.yml.', 'Warning: All your urls will change from example.com/page to example.com/[locale]/page']);
         return;
     }
     $this->installedLocale = array_flip($this->settings->get('Core', 'languages'));
     $this->interfaceLocale = array_flip($this->settings->get('Core', 'interface_languages'));
     $this->enabledLocale = array_flip($this->settings->get('Core', 'active_languages'));
     $this->redirectLocale = array_flip($this->settings->get('Core', 'redirect_languages'));
     $this->defaultEnabledLocale = $this->settings->get('Core', 'default_language');
     $this->defaultInterfaceLocale = $this->settings->get('Core', 'default_interface_language');
     $this->output->writeln($this->formatter->title('Fork CMS locale enable'));
     $this->showLocaleOverview();
     $this->selectWorkingLocale();
     if (!$this->askToInstall()) {
         return;
     }
     $this->askToAddInterfaceLocale();
     if ($this->askToMakeTheLocaleAccessibleToVisitors()) {
         $this->askToEnableTheLocaleForRedirecting();
     }
 }
All Usage Examples Of common\ModulesSettings::get