You are here

public function LivechatController::adminForm in LiveChat 8.3

Method adminForm().

1 string reference to 'LivechatController::adminForm'
livechat.routing.yml in ./livechat.routing.yml
livechat.routing.yml

File

src/Controller/LivechatController.php, line 52

Class

LivechatController
LivechatController class.

Namespace

Drupal\livechat\Controller

Code

public function adminForm() {
  $settings = $this
    ->config('livechat.settings');
  $livechat_props['licence_number'] = $settings
    ->get('licence_number');
  $livechat_props['login'] = $settings
    ->get('livechat_login');
  $livechat_props['mobile'] = $settings
    ->get('livechat_mobile');
  $host = $this->request
    ->getSchemeAndHttpHost();
  $render = [
    '#theme' => 'livechat_settings',
  ];
  $render['#attached'] = [
    'library' => [
      'livechat/livechat_css',
      'livechat/livechat_admin',
    ],
  ];
  $url_saveLicense = Url::fromUri('internal:/admin/config/services/livechat/saveLicense');
  $url_saveProps = Url::fromUri('internal:/admin/config/services/livechat/saveProperties');
  $url_reset = Url::fromUri('internal:/admin/config/services/livechat/reset');
  $render['#attached']['drupalSettings']['livechat']['livechat_admin']['livechat_props'] = $livechat_props;
  $render['#attached']['drupalSettings']['livechat']['livechat_admin']['save_license_url'] = $host . $url_saveLicense
    ->toString();
  $render['#attached']['drupalSettings']['livechat']['livechat_admin']['reset_properties_url'] = $host . $url_reset
    ->toString();
  $render['#attached']['drupalSettings']['livechat']['livechat_admin']['save_properties_url'] = $host . $url_saveProps
    ->toString();
  return $render;
}