You are here

protected function YamlFormSubmissionForm::getYamlFormSetting in YAML Form 8

Get a form submission's form setting.

Parameters

string $name: Setting name.

null|mixed $default_value: Default value.

Return value

mixed A form setting.

12 calls to YamlFormSubmissionForm::getYamlFormSetting()
YamlFormSubmissionForm::actions in src/YamlFormSubmissionForm.php
Returns an array of supported actions for the current entity form.
YamlFormSubmissionForm::autosave in src/YamlFormSubmissionForm.php
Form submission handler to autosave when there are validation errors.
YamlFormSubmissionForm::checkTotalLimit in src/YamlFormSubmissionForm.php
Check form submission total limits.
YamlFormSubmissionForm::checkUserLimit in src/YamlFormSubmissionForm.php
Check form submission user limit.
YamlFormSubmissionForm::draftEnabled in src/YamlFormSubmissionForm.php
Determine if drafts are enabled.

... See full list

File

src/YamlFormSubmissionForm.php, line 1462

Class

YamlFormSubmissionForm
Provides a form to collect and edit submissions.

Namespace

Drupal\yamlform

Code

protected function getYamlFormSetting($name, $default_value = NULL) {

  // Get form settings with default values.
  if (empty($this->settings)) {
    $this->settings = $this
      ->getYamlForm()
      ->getSettings();
    $default_settings = $this
      ->config('yamlform.settings')
      ->get('settings');
    foreach ($default_settings as $key => $value) {
      $key = str_replace('default_', '', $key);
      if (empty($this->settings[$key])) {
        $this->settings[$key] = $value;
      }
    }
  }
  if (isset($this->settings[$name])) {
    return $this->tokenManager
      ->replace($this->settings[$name], $this
      ->getEntity());
  }
  else {
    return $default_value;
  }
}