diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 28f6a69d..39ab967d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog 1.7.0 (Unreleased) ----------------------- - Fix #509: Fix event type visibility +- Enh #512: Surround the widget wall entry links with a dedicated HTML class 1.6.4 (Unreleased) ----------------------- diff --git a/widgets/DownloadIcsLink.php b/widgets/DownloadIcsLink.php index a5d3a3ce..e077abed 100644 --- a/widgets/DownloadIcsLink.php +++ b/widgets/DownloadIcsLink.php @@ -11,7 +11,6 @@ use humhub\libs\Html; use humhub\modules\calendar\helpers\Url; use humhub\modules\calendar\interfaces\event\CalendarEventIF; -use humhub\modules\calendar\models\CalendarEntry; use Yii; /** @@ -28,9 +27,17 @@ class DownloadIcsLink extends Widget public function run() { if ($this->calendarEntry === null) { - return; + return ''; } - return Html::a(Yii::t('CalendarModule.base', 'Download ICS'), Url::toEntryDownloadICS($this->calendarEntry), ['target' => '_blank']); + return Html::tag( + 'span', + Html::a( + Yii::t('CalendarModule.base', 'Download ICS'), + Url::toEntryDownloadICS($this->calendarEntry), + ['target' => '_blank'], + ), + ['class' => 'calendar-entry-ics-download'], + ); } } diff --git a/widgets/ReminderLink.php b/widgets/ReminderLink.php index 16cf4d65..f63cd8c5 100644 --- a/widgets/ReminderLink.php +++ b/widgets/ReminderLink.php @@ -8,6 +8,7 @@ namespace humhub\modules\calendar\widgets; use humhub\components\Widget; +use humhub\libs\Html; use humhub\modules\calendar\helpers\Url; use humhub\modules\calendar\interfaces\event\CalendarEventIF; use humhub\modules\content\components\ContentActiveRecord; @@ -27,10 +28,16 @@ class ReminderLink extends Widget public function run() { - if (!$this->entry || !$this->entry instanceof ContentActiveRecord || !$this->entry instanceof CalendarEventIF) { + if (!$this->entry instanceof ContentActiveRecord || !$this->entry instanceof CalendarEventIF) { return; } - return ModalButton::asLink(Yii::t('CalendarModule.base', 'Set reminder'))->load(Url::toUserLevelReminderConfig($this->entry))->loader(true); + return Html::tag( + 'span', + ModalButton::asLink(Yii::t('CalendarModule.base', 'Set reminder')) + ->load(Url::toUserLevelReminderConfig($this->entry)) + ->loader(true), + ['class' => 'calendar-entry-reminder'], + ); } }