Skip to content

Commit

Permalink
41951 add condition show property status for unit detail
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-eastgate committed Apr 9, 2024
1 parent 230d5b9 commit 1241858
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion plugin/EstateList.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,12 @@ public function estateIterator($modifier = EstateViewFieldModifierTypes::MODIFIE
}
$recordRaw = $this->_recordsRaw[$this->_currentEstate['id']]['elements'] ?? [];

if ($this->getShowEstateMarketingStatus()) {
$showEstateMarketingStatusOfUnitList = false;
if ($this->_unitsViewName != null) {
$showEstateMarketingStatusOfUnitList = $this->_pEnvironment->getEstateUnitsByName($this->_unitsViewName)->getShowEstateMarketingStatus();
}

if ($this->getShowEstateMarketingStatus() || $showEstateMarketingStatusOfUnitList) {
$pEstateStatusLabel = $this->_pEnvironment->getEstateStatusLabel();
$recordModified['vermarktungsstatus'] = $pEstateStatusLabel->getLabel($recordRaw);
}
Expand Down
8 changes: 8 additions & 0 deletions plugin/EstateUnits.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ public function getSubEstateIds(int $estateId): array
return $this->_estateUnits[$estateId] ?? [];
}

/**
* @return bool
*/
public function getShowEstateMarketingStatus(): bool
{
return $this->_pEstateUnitsConfiguration->getEstateList()->getShowEstateMarketingStatus();
}

/**
* @param int $estateId
* @return int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private function isEstateListPage(string $content): bool
{
return $this->matchesShortcode($content, self::ESTATE_TAG, 'view', '[^"]*') &&
!$this->matchesShortcode($content, self::ESTATE_TAG, 'view', 'detail') ||
$this->matchesShortcode($content, self::ESTATE_TAG, 'units', '[^"]*');
$this->matchesShortcode($content, self::ESTATE_TAG, 'units', '[^"]*') &&
!$this->matchesShortcode($content, self::ESTATE_TAG, 'units', '.*detail.*');
}

/**
Expand Down Expand Up @@ -182,7 +183,7 @@ private function isFormPage(string $content): bool
*/
private function matchesShortcode(string $content, string $tag, string $attribute, string $valuePattern): bool
{
$pattern = '/\[' . $tag . '\s+' . $attribute . '="' . $valuePattern . '"\]/';
$pattern = '/\[' . preg_quote($tag, '/') . '\s+.*?' . preg_quote($attribute, '/') . '="' . $valuePattern . '".*?\]/';
return (bool) preg_match($pattern, $content);
}

Expand Down

0 comments on commit 1241858

Please sign in to comment.