Skip to content

Commit

Permalink
Add quarter PID in pluginConfiguration and fix link
Browse files Browse the repository at this point in the history
  • Loading branch information
okmiim committed Aug 6, 2022
1 parent a7f98fc commit 5aacf29
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
28 changes: 28 additions & 0 deletions Classes/Domain/Model/PluginConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ class PluginConfiguration extends AbstractModel
*/
protected $yearPid;

/**
* Quarter PID.
*
* @var int
* @DatabaseField("int")
*/
protected $quarterPid;

/**
* Month PID.
*
Expand Down Expand Up @@ -271,6 +279,26 @@ public function setYearPid($yearPid)
$this->yearPid = $yearPid;
}

/**
* Get quarter PID.
*
* @return int
*/
public function getQuarterPid(): int
{
return $this->quarterPid;
}

/**
* Set quarter PID.
*
* @param int $quarterPid
*/
public function setQuarterPid(int $quarterPid): void
{
$this->quarterPid = $quarterPid;
}

/**
* Get month PID.
*
Expand Down
1 change: 1 addition & 0 deletions Classes/Service/PluginConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function respectPluginConfiguration(array $settings)
'detailPid',
'listPid',
'yearPid',
'quarterPid',
'monthPid',
'weekPid',
'dayPid',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'detail_pid' => $defaultPidConfiguration,
'list_pid' => $defaultPidConfiguration,
'year_pid' => $defaultPidConfiguration,
'quarter_pid' => $defaultPidConfiguration,
'month_pid' => $defaultPidConfiguration,
'week_pid' => $defaultPidConfiguration,
'day_pid' => $defaultPidConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Yaml/RouteEnhancers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ routeEnhancers:
_controller: 'Calendar::detail'
- routePath: '/{calendarize_year_label}/{year}'
_controller: 'Calendar::year'
- routePath: '/{calendarize_quarter_label}/{quarter}'
- routePath: '/{calendarize_quarter_label}/{year}/{quarter}'
_controller: 'Calendar::quarter'
- routePath: '/{calendarize_month_label}/{year}/{month}'
_controller: 'Calendar::month'
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<trans-unit id="tx_calendarize_domain_model_pluginconfiguration.year_pid">
<source>Year PID</source>
</trans-unit>
<trans-unit id="tx_calendarize_domain_model_pluginconfiguration.quarter_pid">
<source>Quarter PID</source>
</trans-unit>
<trans-unit id="tx_calendarize_domain_model_pluginconfiguration.list_pid">
<source>List PID</source>
</trans-unit>
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Templates/Calendar/Quarter.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

<f:if condition="{settings.quarterPid}">
<f:if condition="{c:ifDateUpper(base: settings.dateLimitBrowserPrev, check:{date -> c:dateTime.modify(modification: '-1 months')})}">
<c:link.quarter pageUid="{settings.monthPid}" date="{date -> c:dateTime.modify(modification: '-1 months')}">
<c:link.quarter pageUid="{settings.quarterPid}" date="{date -> c:dateTime.modify(modification: '-1 months')}">
&lt;
</c:link.quarter>
</f:if>
</f:if>
Q{quarter} <f:format.date format="%Y">{date}</f:format.date>
<f:if condition="{settings.quarterPid}">
<f:if condition="{c:ifDateLower(base: settings.dateLimitBrowserNext, check:{date -> c:dateTime.modify(modification: '+4 months')})}">
<c:link.quarter pageUid="{settings.monthPid}" date="{date -> c:dateTime.modify(modification: '+4 months')}">
<c:link.quarter pageUid="{settings.quarterPid}" date="{date -> c:dateTime.modify(modification: '+4 months')}">
&gt;
</c:link.quarter>
</f:if>
Expand Down

0 comments on commit 5aacf29

Please sign in to comment.