Skip to content

Commit

Permalink
Merge pull request #5 from contao-estatemanager/develop
Browse files Browse the repository at this point in the history
Consider Google Maps Bundle before adjusting the palette
  • Loading branch information
doishub authored Jul 23, 2020
2 parents e246bfd + 133dad6 commit 747b0a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use ContaoEstateManager\EstateManager\EstateManager;
use ContaoEstateManager\Project\EstateManagerProject;
use ContaoEstateManager\GoogleMaps\EstateManagerGoogleMaps;

class Plugin implements BundlePluginInterface
{
Expand All @@ -28,7 +29,7 @@ public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(EstateManagerProject::class)
->setLoadAfter([ContaoCoreBundle::class, EstateManager::class])
->setLoadAfter([ContaoCoreBundle::class, EstateManager::class, EstateManagerGoogleMaps::class])
->setReplace(['estatemanager-project']),
];
}
Expand Down
16 changes: 10 additions & 6 deletions src/Resources/contao/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
// Add module palette for projects
$GLOBALS['TL_DCA']['tl_module']['palettes']['realEstateProjectList'] = '{title_legend},name,headline,type;{config_legend},numberOfItems,perPage,filterMode,childrenObserveFiltering,addSorting;{redirect_legend},jumpTo,jumpToProject;{item_extension_legend:hide},addProvider,addContactPerson;{template_legend:hide},statusTokens,customTpl,realEstateProjectTemplate,realEstateTemplate,realEstateProviderTemplate,realEstateContactPersonTemplate;{image_legend:hide},imgSize,projectImgSize,providerImgSize,contactPersonImgSize;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';

// Extend the googlemaps palettes
Contao\CoreBundle\DataContainer\PaletteManipulator::create()
->addField(array('showProjects'), 'config_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)
->applyToPalette('realEstateGoogleMap', 'tl_module')
;

// Add field
$GLOBALS['TL_DCA']['tl_module']['fields']['showProjects'] = array
(
Expand Down Expand Up @@ -77,4 +71,14 @@
},
'sql' => "varchar(64) NOT NULL default ''"
);

// Extend the googlemaps palettes
$bundles = Contao\System::getContainer()->getParameter('kernel.bundles');

if (isset($bundles['EstateManagerGoogleMaps']))
{
Contao\CoreBundle\DataContainer\PaletteManipulator::create()
->addField(array('showProjects'), 'config_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)
->applyToPalette('realEstateGoogleMap', 'tl_module');
}
}

0 comments on commit 747b0a7

Please sign in to comment.