Skip to content
Snippets Groups Projects
Commit c9377fdd authored by purencool's avatar purencool
Browse files

Modernised editor controller

parent 6e6a6db9
No related branches found
No related tags found
No related merge requests found
......@@ -23,16 +23,16 @@ class Editor extends ControllerBase implements ContainerInjectionInterface {
/**
* Twig object.
*
* @var mixed
* @var TwigEnvironment
*/
protected $twig;
/**
* Data sent to controller.
*
* @var mixed
* @var array
*/
protected $dataArray;
protected array $dataArray;
/**
* Constructor.
......@@ -65,7 +65,7 @@ class Editor extends ControllerBase implements ContainerInjectionInterface {
* @return string
* Domain that is assigned to the front page.
*/
protected function domainPath() {
protected function domainPath(): string {
$url_options = [
'absolute' => TRUE,
'language' => \Drupal::languageManager()->getCurrentLanguage(),
......@@ -79,7 +79,7 @@ class Editor extends ControllerBase implements ContainerInjectionInterface {
* @return array
* Array of paths for template rendering variables.
*/
protected function templateVariables() {
protected function templateVariables(): array {
$url = "";
if (!empty(FormsStorage::getStorage('browser_development_settings')['browser_development_settings']['uri'])) {
......@@ -112,7 +112,7 @@ class Editor extends ControllerBase implements ContainerInjectionInterface {
* @return string
* Returns data structure for troubleshooting
*/
protected function templateVariablesDebug() {
protected function templateVariablesDebug(): string {
return var_export($this->dataArray, TRUE);
}
......@@ -123,7 +123,7 @@ class Editor extends ControllerBase implements ContainerInjectionInterface {
* Template that needs to be returned.
* @throws \Throwable
*/
public function getContent() {
public function getContent(): Response {
$drupalModulePath = \Drupal::service('extension.list.module')->getPath('browser_development');
$response = new Response();
......
......@@ -78,17 +78,16 @@ class FileSystemStructure {
/**
*
* @param array $path
*
* @return array
*/
public function setPathArray($path = []) {
public function setPathArray(array $path = []): array {
if (!empty($path)) {
$this->globalFilePathArray['base_path'] = $path;
$arr['base_path'] = $this->globalFilePathArray['base_path'];
FormsStorage::setStorage('browser_development_settings', $arr);
}
}
/**
......
......@@ -17,7 +17,7 @@ class FormsStorage {
* @param string $input
* String creator.
*/
protected static function storage($formName, $input) {
protected static function storage($formName,$input) {
$config = \Drupal::service('config.factory')
->getEditable('browser_development.settings');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment