Giter Club home page Giter Club logo

newspage's Introduction

Newspage

This extension provides a new doktype to be used for news that need to have flexible content, e.g. tt_content elements.

The new doktype that is registered is doktype=24.

Plugins

This extension registers 3 Plugins:

  • list
    • this plugin shows a list of all news, optionally filtered by a value selected in the plugin, and optionally a frontend filter can be displayed
  • recent
  • teaser
  • newsJson
    • this plugin comes with its own page type (1623330999) and returns all news as a JSON with teaser images pre-processed

Filters

This plugin comes with a couple of filters pre-shipped:

  • Category: both as a backend filter and front end filter
  • Categories: a front end filter that allows multiple categories to be selected
    • this filter combines the selected categories using an or operation
  • Date: a front end filter that filters by year and month

Custom Filters

If you want to create your own filters, you can register them in your ext_localconf.php with the following call

<?php

B13\Newspage\Service\FilterService::registerFilter(
   'Filter Name',                                                              // this name will be used to call the filter internally
   \Vendor\Ext\Filter\ExampleFilter::class,
   'LLL:EXT:vendor/ext/Private/Language/newspage.xlf:filter.name',             // label to use for the plugin and frontend filter
   'EXT:site_tecselect/Configuration/FlexForms/Newspage/Filter/Partner.xml'    // optional flexform definition for a backend filter
);

Your class should implement the B13\Newspage\Filter\FilterInterface and therefore implement the functions getItems() and getQueryConstraint().

The function getItems() is used to get all possible values for the filter (both for the plugin settings, as well as the frontend filter).

getQueryContraint() is used to add the filtering restriction to the query in the list plugin. This function can also return null if not all required values are set, or you want to filter everything in the front end using JavaScript.

For an example take a look at the two filters provided by this extension.

If you want to enable the backend plugin filter, you should provide a FlexForm definition that selects the data to filter by. This file then needs to be passed as the fourth argument when registering the filter.

The created field is automatically passed as settings.prefilters.name with the name you registered it with.

For an example take a look at EXT:newspage/Configuration/FlexForms/Filter/Category.xml

Assets

At b13 we often use additional page types (doktype) for categories, overview pages, and tags. This extension adds a number of assets ready to use for your own custom doktypes:

Icon Identifier Icon
apps-pagetree-newspage-page
apps-pagetree-newspage-article
apps-pagetree-newspage-category
apps-pagetree-newspage-overview
apps-pagetree-newspage-tag
mimetypes-newspage-page

Page Layout edit mode

In the page module layout view, the most important properties (title, category, media, slug, date) can be edited without leaving the layout view. This behavior can be disabled in the extension settings ('layout_edit_mode' => '0') to display a regular page view.

To customize the fields, use the dedicated tx_newspage_layout palette:

$GLOBALS['TCA']['pages']['palettes']['tx_newspage_layout']['showitem'] = 'title,abstract,slug';

ToDos

  • tx_newspage_domain_model_category should be replaced by sys_category as there is no real value from creating a new model for a problem that is already solved within TYPO3
  • make recent plugin more filterable (use added filters from list ?)

newspage's People

Contributors

achimfritz avatar b13-michaelsemle avatar bmack avatar davidsteeb avatar dgorges avatar jschlier avatar ochorocho avatar wobraun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.