You are here

protected function N1EDEcosystemCKEditorPlugin::getConfigParam in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8

4 calls to N1EDEcosystemCKEditorPlugin::getConfigParam()
N1EDEcosystemCKEditorPlugin::addBooleanToForm in src/Plugin/N1EDEcosystemCKEditorPlugin.php
N1EDEcosystemCKEditorPlugin::addJsonToForm in src/Plugin/N1EDEcosystemCKEditorPlugin.php
N1EDEcosystemCKEditorPlugin::addNumberToForm in src/Plugin/N1EDEcosystemCKEditorPlugin.php
N1EDEcosystemCKEditorPlugin::addStringToForm in src/Plugin/N1EDEcosystemCKEditorPlugin.php

File

src/Plugin/N1EDEcosystemCKEditorPlugin.php, line 103

Class

N1EDEcosystemCKEditorPlugin
Defines plugin.

Namespace

Drupal\n1ed\Plugin

Code

protected function getConfigParam($settings, $name, $default, $type) {
  if (isset($settings[$name]) && is_string($settings[$name]) && strlen($settings[$name]) > 0) {
    $value = $settings[$name];
  }
  else {
    $value = $default;
  }
  if (isset($type) && $type == 'number') {
    $value = intval($value);
  }
  else {
    if (isset($type) && $type == 'boolean') {
      if ($value == 'true') {
        $value = true;
      }
      else {
        if ($value == 'false') {
          $value = false;
        }
      }
    }
    else {
      if (isset($type) && $type == 'json') {
        if ($value != '') {
          $value = json_decode($value);
        }
      }
    }
  }
  $drupal8_specific_defaults = array(
    'urlFileManager' => '/flmngr',
    'urlFiles' => '/sites/default/files/flmngr',
    'dirUploads' => '/uploads/',
  );
  if (isset($drupal8_specific_defaults[$name]) && $value == '') {
    $value = $drupal8_specific_defaults[$name];
  }
  return $value;
}