Skip to content

Commit

Permalink
Use the Lang facade rather than the trans helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed Jun 28, 2020
1 parent c84c51c commit dea03a6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions modules/cms/controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function index()

$this->bodyClass = 'compact-container';
$this->pageTitle = 'cms::lang.cms.menu_label';
$this->pageTitleTemplate = '%s '.trans($this->pageTitle);
$this->pageTitleTemplate = '%s '.Lang::get($this->pageTitle);

if (Request::ajax() && Request::input('formWidgetAlias')) {
$this->bindFormWidgetToController();
Expand Down Expand Up @@ -380,7 +380,7 @@ public function onGetTemplateList()
public function onExpandMarkupToken()
{
if (!$alias = post('tokenName')) {
throw new ApplicationException(trans('cms::lang.component.no_records'));
throw new ApplicationException(Lang::get('cms::lang.component.no_records'));
}

// Can only expand components at this stage
Expand All @@ -389,15 +389,15 @@ public function onExpandMarkupToken()
}

if (!($names = (array) post('component_names')) || !($aliases = (array) post('component_aliases'))) {
throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $alias]));
throw new ApplicationException(Lang::get('cms::lang.component.not_found', ['name' => $alias]));
}

if (($index = array_get(array_flip($aliases), $alias, false)) === false) {
throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $alias]));
throw new ApplicationException(Lang::get('cms::lang.component.not_found', ['name' => $alias]));
}

if (!$componentName = array_get($names, $index)) {
throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $alias]));
throw new ApplicationException(Lang::get('cms::lang.component.not_found', ['name' => $alias]));
}

$manager = ComponentManager::instance();
Expand Down Expand Up @@ -556,7 +556,7 @@ protected function canResetTemplate($template)
protected function validateRequestTheme()
{
if ($this->theme->getDirName() != Request::input('theme')) {
throw new ApplicationException(trans('cms::lang.theme.edit.not_match'));
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_match'));
}
}

Expand All @@ -576,7 +576,7 @@ protected function resolveTypeClassName($type)
];

if (!array_key_exists($type, $types)) {
throw new ApplicationException(trans('cms::lang.template.invalid_type'));
throw new ApplicationException(Lang::get('cms::lang.template.invalid_type'));
}

return $types[$type];
Expand All @@ -593,7 +593,7 @@ protected function loadTemplate($type, $path)
$class = $this->resolveTypeClassName($type);

if (!($template = call_user_func([$class, 'load'], $this->theme, $path))) {
throw new ApplicationException(trans('cms::lang.template.not_found'));
throw new ApplicationException(Lang::get('cms::lang.template.not_found'));
}

/**
Expand Down Expand Up @@ -628,7 +628,7 @@ protected function createTemplate($type)
$class = $this->resolveTypeClassName($type);

if (!($template = $class::inTheme($this->theme))) {
throw new ApplicationException(trans('cms::lang.template.not_found'));
throw new ApplicationException(Lang::get('cms::lang.template.not_found'));
}

return $template;
Expand All @@ -645,7 +645,7 @@ protected function getTabTitle($type, $template)
if ($type === 'page') {
$result = $template->title ?: $template->getFileName();
if (!$result) {
$result = trans('cms::lang.page.new');
$result = Lang::get('cms::lang.page.new');
}

return $result;
Expand All @@ -654,7 +654,7 @@ protected function getTabTitle($type, $template)
if ($type === 'partial' || $type === 'layout' || $type === 'content' || $type === 'asset') {
$result = in_array($type, ['asset', 'content']) ? $template->getFileName() : $template->getBaseFileName();
if (!$result) {
$result = trans('cms::lang.'.$type.'.new');
$result = Lang::get('cms::lang.'.$type.'.new');
}

return $result;
Expand All @@ -681,7 +681,7 @@ protected function makeTemplateFormWidget($type, $template, $alias = null)
];

if (!array_key_exists($type, $formConfigs)) {
throw new ApplicationException(trans('cms::lang.template.not_found'));
throw new ApplicationException(Lang::get('cms::lang.template.not_found'));
}

$widgetConfig = $this->makeConfig($formConfigs[$type]);
Expand All @@ -708,12 +708,12 @@ protected function upgradeSettings($settings, $prevSettings)

if ($componentProperties !== null) {
if ($componentNames === null || $componentAliases === null) {
throw new ApplicationException(trans('cms::lang.component.invalid_request'));
throw new ApplicationException(Lang::get('cms::lang.component.invalid_request'));
}

$count = count($componentProperties);
if (count($componentNames) != $count || count($componentAliases) != $count) {
throw new ApplicationException(trans('cms::lang.component.invalid_request'));
throw new ApplicationException(Lang::get('cms::lang.component.invalid_request'));
}

for ($index = 0; $index < $count; $index++) {
Expand Down

0 comments on commit dea03a6

Please sign in to comment.