Skip to content

Commit

Permalink
use ::class constants insteadof string classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus committed Mar 2, 2022
1 parent 511d76d commit 7149de3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
17 changes: 10 additions & 7 deletions src/Resources/contao/dca/hofff_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

declare(strict_types=1);

use Hofff\Contao\Content\DCA\DCA;
use Hofff\Contao\Content\Util\Util;

$GLOBALS['TL_DCA']['hofff_content']['palettes']['default']
= ';{hofff_content_legend},hofff_content_references'
. ';{template_legend},hofff_content_template,hofff_content_exclude_from_search,hofff_content_bypass_cache';
Expand Down Expand Up @@ -36,15 +39,15 @@
'label' => &$GLOBALS['TL_LANG']['hofff_content']['translate'],
'inputType' => 'checkbox',
'eval' => [
'tl_class' => Hofff\Contao\Content\Util\Util::isLanguageRelationsLoaded()
'tl_class' => Util::isLanguageRelationsLoaded()
? 'w50 cbx m12'
: 'hidden',
],
];
$sourceSections = [
'label' => &$GLOBALS['TL_LANG']['hofff_content']['source_sections'],
'inputType' => 'checkbox',
'options_callback' => Hofff\Contao\Content\DCA\DCA::getLayoutSectionOptionsCallback(),
'options_callback' => DCA::getLayoutSectionOptionsCallback(),
'eval' => [
'multiple' => true,
'tl_class' => 'clr',
Expand All @@ -70,8 +73,8 @@
'sql' => 'blob NULL',
'nodeTypes' => [
'article' => [
'icon_callback' => [ 'Hofff\\Contao\\Content\\DCA\\DCA', 'getArticleIcon' ],
'label_callback' => [ 'Hofff\\Contao\\Content\\DCA\\DCA', 'getArticleLabel' ],
'icon_callback' => [DCA::class, 'getArticleIcon' ],
'label_callback' => [DCA::class, 'getArticleLabel' ],
'template' => 'hofff_content_node_article',
'fields' => [
'exclude_from_search' => $excludeFromSearch,
Expand All @@ -82,7 +85,7 @@
],
],
'page' => [
'icon_callback' => [ 'Hofff\\Contao\\Content\\DCA\\DCA', 'getPageIcon' ],
'icon_callback' => [DCA::class, 'getPageIcon' ],
'template' => 'hofff_content_node_page',
'fields' => [
'exclude_from_search' => $excludeFromSearch,
Expand All @@ -96,7 +99,7 @@
'theme' => ['icon' => 'themes.gif'],
'module' => [
'icon' => 'modules.gif',
'label_callback' => [ 'Hofff\\Contao\\Content\\DCA\\DCA', 'getModuleLabel' ],
'label_callback' => [DCA::class, 'getModuleLabel' ],
'template' => 'hofff_content_node_module',
'fields' => [
'exclude_from_search' => $excludeFromSearch,
Expand All @@ -112,7 +115,7 @@
'label' => &$GLOBALS['TL_LANG']['hofff_content']['template'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => Hofff\Contao\Content\DCA\DCA::getTemplateGroupOptionsCallback(
'options_callback' => DCA::getTemplateGroupOptionsCallback(
'hofff_content_template_prefixes'
),
'eval' => [
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/contao/dca/tl_article.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Contao\CoreBundle\DataContainer\PaletteManipulator;
use Hofff\Contao\Content\DCA\ArticleDCA;

(static function (): void {
PaletteManipulator::create()
Expand All @@ -16,7 +17,7 @@

$label = &$GLOBALS['TL_DCA']['tl_article']['list']['label'];
$label['label_callback_hofff_content'] = $label['label_callback'];
$label['label_callback'] = ['Hofff\\Contao\\Content\\DCA\\ArticleDCA', 'labelCallback'];
$label['label_callback'] = [ArticleDCA::class, 'labelCallback'];
unset($label);
}
)();
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/contao/dca/tl_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

declare(strict_types=1);

use Hofff\Contao\Content\DCA\DCABuilder;

$GLOBALS['TL_DCA']['tl_content']['list']['sorting']['headerFields'][] = 'hofff_content_hide';

call_user_func(static function (): void {
$builder = new Hofff\Contao\Content\DCA\DCABuilder();
$builder = new DCABuilder();
$builder->setPaletteTemplate(
'{type_legend},type'
. '%s'
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/contao/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

declare(strict_types=1);

use Hofff\Contao\Content\DCA\DCABuilder;

call_user_func(static function (): void {
$builder = new Hofff\Contao\Content\DCA\DCABuilder();
$builder = new DCABuilder();
$builder->setPaletteTemplate(
'{title_legend},name,type'
. '%s'
Expand Down

0 comments on commit 7149de3

Please sign in to comment.