Skip to content

Commit

Permalink
Merge pull request #14 from contao-estatemanager/feature/compile-hook
Browse files Browse the repository at this point in the history
Add hook `compileRealEstateProject`
  • Loading branch information
doishub authored Jul 27, 2022
2 parents a093425 + 1a98e33 commit d3dd45e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Resources/contao/modules/ModuleRealEstateProjectList.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,22 @@ protected function compile()

$objProjects->reset();

while($objProjects->next())
if (isset($GLOBALS['CEM_HOOKS']['compileRealEstateProject']) && \is_array($GLOBALS['CEM_HOOKS']['compileRealEstateProject']))
{
$realEstate = new RealEstateModulePreparation($objProjects->current(), $this,null);
foreach ($GLOBALS['CEM_HOOKS']['compileRealEstateProject'] as $callback)
{
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($objProjects, $arrProjects, $this);
}
}

foreach($objProjects as $objProject)
{
$realEstate = new RealEstateModulePreparation($objProject, $this,null);
$objTemplate = new FrontendTemplate($this->strProjectTemplate);

$objTemplate->realEstate = $realEstate;
$objTemplate->children = $arrProjects[ $objProjects->master ]['children'] ?: array();
$objTemplate->children = $arrProjects[ $objProject->master ]['children'] ?: array();
$objTemplate->jumpTo = $this->jumpToProject;
$objTemplate->imgSize = $this->projectImgSize;
$objTemplate->details = Project::getProjectSpecificDetails($realEstate);
Expand All @@ -180,11 +189,11 @@ protected function compile()
}
elseif(!!$this->childrenObserveFiltering)
{
$objTemplate->numberOfChildren = $arrNumberOfChildren[ $objProjects->master ];
$objTemplate->numberOfChildren = $arrNumberOfChildren[ $objProject->master ];
}
else
{
$objTemplate->numberOfChildren = count($arrProjects[ $objProjects->master ]['children']);
$objTemplate->numberOfChildren = count($arrProjects[ $objProject->master ]['children']);
}

// add provider
Expand Down

0 comments on commit d3dd45e

Please sign in to comment.