kapelanmedien / km-eventnews-filter

通过组织者、地点、日期、分类和标签筛选活动新闻

安装: 2

依赖项: 0

建议者: 0

安全: 0

类型:typo3-cms-extension

1.0.0 2024-08-26 13:49 UTC

This package is not auto-updated.

Last update: 2024-09-24 12:18:42 UTC


README

此扩展使您能够在前端根据以下属性筛选事件新闻

  • 组织者
  • 地点
  • 日期从 & 到
  • 分类
  • 标签

此扩展是对EXT:news_filter的修改

要求

  • TYPO3 10.4
  • news 9.x
  • eventnews 5.x

使用方法

  1. 安装此扩展就像安装其他扩展一样。可以使用扩展管理器或composer,执行composer require kapelanmedien/km-eventnews-filter
  2. 在新闻插件中选择“列表”操作并勾选“启用筛选”附加复选框
  3. 选择包含分类和标签的文件夹。
  4. 为了使按组织者和地点筛选工作,必须选择事件限制“仅活动”。

TypoScript

需要以下TypoScript

plugin.tx_news.settings.demandClass = KapelanMedien\KmEventnewsFilter\Domain\Model\Dto\Demand

模板

将以下部分添加到您的List.html

<f:form action="list" object="{extendedVariables.searchDemand}" name="search" class="news-search-form mb-3">
    <fieldset>
        <div class="mb-3">
            <label class="form-label" for="news-subject"><f:translate key="search-subject" /></label>
            <f:form.textfield id="news-subject" property="subject" class="form-control" />
        </div>

        <f:if condition="{extendedVariables.organizers}">
            <div class="mb-3">
                <label class="form-label" for="organizers"><f:translate key="organizers" extensionName="eventnews" /></label>
                <f:form.select
                        property="organizers"
                        id="organizers"
                        class="form-select"
                        options="{extendedVariables.organizers}"
                        optionValueField="uid"
                        optionLabelField="title"
                        multiple="multiple"
                    />
            </div>
        </f:if>
        <f:if condition="{extendedVariables.locations}">
            <div class="mb-3">
                <label class="form-label" for="locations"><f:translate key="locations" extensionName="eventnews" /></label>
                <f:form.select
                        property="locations"
                        id="locations"
                        class="form-select"
                        options="{extendedVariables.locations}"
                        optionValueField="uid"
                        optionLabelField="title"
                        multiple="multiple"
                    />
            </div>
        </f:if>
        <f:if condition="{extendedVariables.categories}">
            <div class="mb-3">
                <legend class="form-label"><f:translate key="categories" /></legend>
                <f:for each="{extendedVariables.categories}" as="category">
                    <div class="form-check form-check-inline">
                        <f:form.checkbox property="filteredCategories" value="{category.uid}" id="category_{category.uid}" class="form-check-input" />
                        <label class="form-check-label" for="category_{category.uid}">{category.title}</label>
                    </div>
                </f:for>
            </div>
        </f:if>
        <f:if condition="{extendedVariables.tags}">
            <div class="mb-3">
                <legend class="form-label"><f:translate key="tags" /></legend>
                <f:for each="{extendedVariables.tags}" as="tag">
                    <div class="form-check form-check-inline">
                        <f:form.checkbox property="filteredTags" value="{tag.uid}" id="tag_{tag.uid}" class="form-check-input" />
                        <label class="form-check-label" for="tag_{tag.uid}">{tag.title}</label>
                    </div>
                </f:for>
            </div>
        </f:if>

        <div class="mb-3">
            <label class="form-label" for="searchDateFrom">Date</label>
            <div class="input-group">
                <f:form.textfield type="date" class="form-control" id="searchDateFrom" property="searchDateFrom" />
                <label class="input-group-text" for="searchDateTo">-</label>
                <f:form.textfield type="date" class="form-control" id="searchDateTo" property="searchDateTo" />
            </div>
        </div>

        <f:form.submit value="{f:translate(key: 'search-start')}" class="btn btn-primary" />
    </fieldset>
</f:form>

按类别、标签、组织者和地点排序

plugin.tx_news {
    settings {
        filterCategoriesOrderBy = title
        filterCategoriesOrderDirection = asc

        filterTagsOrderBy = title
        filterTagsOrderDirection = asc

        filterOrganizersOrderBy = title
        filterOrganizersOrderDirection = asc

        filterLocationsOrderBy = title
        filterLocationsOrderDirection = asc
    }
}