You are here

public function Drupal8Config::getElement in Rocket.Chat 8

Same name and namespace in other branches
  1. 8.2 modules/rocket_chat_api/src/RocketChat/Drupal8Config.php \Drupal\rocket_chat_api\RocketChat\Drupal8Config::getElement()

Get a RocketChatConfigInterface Element.

Parameters

string $elementName: Key value to retrieve from the RocketChatConfigInterface Backend.

string $default: A possible Default to use when no config is found in the backend.

Return value

mixed The retrieved config value.

Overrides RocketChatConfigInterface::getElement

1 method overrides Drupal8Config::getElement()
Test7Config::getElement in modules/rocket_chat_api/src/RocketChat/TestConfig.class.inc
Get a RocketChatConfigInterface Element.

File

modules/rocket_chat_api/src/RocketChat/Drupal8Config.php, line 71

Class

Drupal8Config
Class Drupal8Config connects the API with the drupal system.

Namespace

Drupal\rocket_chat_api\RocketChat

Code

public function getElement($elementName, $default = NULL) {
  switch ($elementName) {
    case 'rocket_chat_url':

      // Fallthrough and modify.
      $elementName = "server";
    default:
      $value = $this->config
        ->get($elementName);
      if (empty($value)) {
        $value = $default;
      }
      return $value;
    case 'rocket_chat_uid':

    // Fallthrough.
    case 'rocket_chat_uit':

      // Fallthrough.
      return $this->state
        ->get($elementName, $default);
  }
}