Download the PHP package heimrichhannot/contao-syndication-type-bundle without Composer

On this page you can find all versions of the php package heimrichhannot/contao-syndication-type-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package contao-syndication-type-bundle

Contao Syndication Type Bundle

Latest Stable Version Total Downloads

This bundle brings an extendable syndication framework to contao. Syndication can be easily added to your own bundle/module/element. There are already some bundles/entites supported out-of-the-box (see features section).

Features

Usage

Requirements

Install

  1. Install with composer or contao manager

    composer require heimrichhannot/contao-syndication-type-bundle

  2. Update database

Article syndication

You can replace the contao article syndication with the syndication of this bundle.

  1. Set huh_syndication_type.enable_article_syndication to true (in your project config.yml)
  2. Clear your cache and update the database
  3. You'll find the new syndication config in your article configuration

Content element syndication

You can add syndication as a content Element to every article.

  1. Set huh_syndication_type.enable_content_syndication to true (in your project config.yml)
  2. Clear your cache and update the database
  3. You'll find the new syndication type in content element type selection

Reader Bundle

  1. Create a new reader config element of type syndication
  2. Select syndications
  3. output the template variable in your template (with raw filter)

Print content

To print your content, you have two options: print the whole page (a simple window.print() link) or use a custom template to print. Print template are written in twig and the file name must start with syndication_type_print_, for example syndication_type_print_default.html.twig. You can extend our default template or create a complete custom template.

While creating you print template, you may want to see a preview without the print popup. To get one, just append synPrintDebug parameter to the print url.

Developers

Customize link rendering

If you need more control over the output of the link rendering, you have different options:

Override or change default templates

You can override following templates (just use the contao template inheritance with twig templates thanks to Twig Support Bundle):

It is also possible to create custom versions like syndication_provider_acme.html.twig. To use a custom link template, you can use the BeforeRenderSyndicationLinks event, pass the option on SyndicationLinkRenderer methods call or decorate the SyndicationLinkRenderer service. Change the provider template can be archived by pass the option on SyndicationLinkRenderer methods call or decorate the SyndicationLinkRenderer service.

Use the BeforeRenderSyndicationLinks event

You can customize the options and the links that are rendered through the BeforeRenderSyndicationLinks.

Example (Contao 4.9+):

Decorate the SyndicationLinkRenderer service

You can customize all options by decorating the SyndicationLinkRenderer service. If you're not familiar with that, it sounds complicated, but symfony make it easy and here is a working example (just change namespaces and class names):

Add syndications to your bundle

Syndication bundle is build to be reused. You can easily add it to your code.

  1. Add all needed fields to your dca

    • We recommend creating a listener to the loadDataContainer Hook
    • Add fields and configuration with SyndicationTypeDcaProvider::prepareDca($table)
    • Generate the palette with SyndicationTypeDcaProvider::getPalette() and place it where it should be. You can pass a boolean parameter to get the palette seperated by legends or not.
  2. Generate syndication links in your controller/module/listener/...

    • create an instance of SyndicationContext
    • generate syndication links with SyndicationLinkProviderGenerator::generateFromContext() (will return a SyndicationLinkProvider instance, which is a collection of SyndicationLink instances)
    • render the syndication links with SyndicationLinkRenderer::renderProvider() (will return the rendered links as string. You could also use/create a custom link renderer)

    For easy of implementation you can access all of these services through SyndicationManager.

  3. Add export support.
    • this should be done, where your content to export is completely configured and fully rendered (or can be fully rendered). In the most cases, this can be done where you generate the syndication links, but maybe it must be done on a later point.
    • create a SyndicationContext instance
    • run ExportSyndicationHandler::exportByContext()

Add custom syndication type

  1. Create a SyndicationType class
    • the class must implement SyndicationTypeInterface (or ExportSyndicationTypeInterface)
    • you can (and we recommend) extend AbstractSyndicationType or AbstractExportSyndicationType (for syndication types which do some export like pdf, print or ical), which already implement their corresponding interfaces
  2. Implement the abstract methods
    • getType() - return an alias for the syndication type
    • generate() - generate the syndication link. A SyndicationContext instance is passed, a SyndicationLink instance must be returned. We recommend to use SyndicationLinkFactory to create the SyndicationLink instance.
  3. Optional: If your SyndicationType extends one of the abstract classes, your can override following methods:
    • getCategory() - customize the syndication category. There are two categories predefined as constants in AbstractSyndicationType: share and export, but it is possible to use a custom category
    • getPalette() - if your syndication type depends on additions configuration, you can set the syndication type palette here
  4. Optional: If your SyndicationType extends one of the abstract classes, your can use the following helper methods:
    • getValueByFieldOption() - return a configuration value from the context (shorthand so you don't have to do all the array validation)
    • appendGetParameterToUrl() - utils to append a get parameter to an url. Useful for creating export links
  5. Register service type class as service with huh.syndication_type.type service tag
  6. Create an Event Subscriber for AddSyndicationTypeFieldsEvent,AddSyndicationTypePaletteSelectorsEvent and AddSyndicationTypeSubpalettesEvent to add custom dca fields and subpalettes

Configuration reference


All versions of contao-syndication-type-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
contao/core-bundle Version ^4.9
heimrichhannot/contao-twig-support-bundle Version ^0.2.16 || ^1.0
psr/container Version ^1.0 || ^2.0
psr/link Version ^1.0 || ^2.0
symfony/config Version ^4.4 || ^5.0 || ^6.0
symfony/event-dispatcher Version ^4.4 || ^5.0 || ^6.0
symfony/event-dispatcher-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/http-foundation Version ^4.4 || ^5.0 || ^6.0
symfony/service-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/string Version ^5.0 || ^6.0
symfony/translation-contracts Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package heimrichhannot/contao-syndication-type-bundle contains the following files

Loading the files please wait ....