GithubHelp home page GithubHelp logo

dmkebusinessgmbh / typo3-t3twig Goto Github PK

View Code? Open in Web Editor NEW
5.0 20.0 5.0 304 KB

TYPO3 extension to render page templates with Twig and extend rn_base for using Twig templates instead of marker templates

Home Page: https://www.dmk-ebusiness.de

PHP 89.40% Twig 10.60%
twig twig-templates typo3 php template-engine typo3-extension fluid

typo3-t3twig's Introduction

README

TYPO3 compatibility Latest Stable Version Total Downloads Build Status License

t3twig - Twig support for TYPO3 with rn_base plugins

What is it for?

Extend rn_base for using twig templates instead of marker templates

It's also possible to use t3twig as template enginge for Typo3 template development insted of fluid templates.

Installation

Install TYPO3 via composer. Maybe you can use our TYPO3-Composer-Webroot Project

From project root you need to run

composer require "dmk/t3twig:~2.0"

Documentation

For usage please have a look in our Documentation

CHANGELOG

typo3-t3twig's People

Contributors

aprettser avatar baachi avatar digedag avatar hannesbochmann avatar mario-seidel avatar mcrasser avatar rengaw83 avatar rockordier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typo3-t3twig's Issues

Formatierung von Attributen per Typoscript

Ich weiß, daß es diesbezüglich schon Anpassungen im Code gibt. Trotzdem würde ich das in diesem Ticket noch mal aufgreifen und skizzieren, wie ich mir eine Umsetzung vorstellen würde.

Anwendungsfall im Plugin
Das Plugin legt eine Entity in den Context zum Rendering per Twig.

$data = new \Tx_Rnbase_Domain_Model_Base( ['images' => '4,5', 'head'=>'Test'] );
$viewData->offsetSet('item', $data);

Die Ausgabe der Daten in Twig erfolgt ohne zusätzliche Anweisungen immer in der Rohform:

{{ item.head }}
{{ item.images }}

Wenn man die Daten aber per TS verarbeiten will, dann muss man einen TS-Pfad mit angeben. Der kann aber nicht absolut sein, sondern muss ich immer unterhalb von "template." befinden. Denn damit wird der TwigRenderer initialisiert. Der typische Aufbau bei einem Plugin würde so aussehen:

plugin.tx_myplugin {
  myaction.template {
    file = EXT:myplugin/Resources/Private/Templates/template.html.twig
    context {
      # Hier können zusätzliche Objekte in den Context gelegt werden.
      info = TEXT
      info.value = Nur ein Beispiel
      # Da der Platz für zusätzliche Context-Daten reserviert ist, kann hier NICHT der Ausgangspunkt für die TS-Formatierung der Daten sein
    }
    # also benötigen wir eine zusätzlichen Startpunkt
    ts {
      image = USER
      image...
      fett.wrap = <strong>|</strong>
    }
  }
}

Die Ausführung des TS sollte nicht wie bei Marker-Templates automatisch stattfinden. Der Template-Entwickler sollte selbst entscheiden können, wie und wann er die Konfiguration nutzen will:

{{ item.head|t3ts('fett') }}
{{ item.images|t3ts('image', {'data': item}) }}

Die Option data bietet, wie besprochen, die Möglichkeit, das data-Attribute im cObject zu setzen.
Ich denke, es ist nicht notwendig und sinnvoll Typoscript aus lib. zu unterstützen. Wer diese Daten benötigt, kann sie wie üblich im Plugin bereitstellen:

plugin.tx_myplugin {
  myaction.template {
    ts {
      image =< lib.images
    }
  }
}

Das würde ich dann mal zur Diskussion stellen. 😄

Add Twig Extension for cObject rendering

Ther should be a Fluid like way, to render a cObject

The Fluid way:

<f:cObject typoscriptObjectPath="lib.testlink" data="{pid: 1, label: 'Wohoo'}" />

In Twig this might look like this:

{{ t3cObject('lib.testlink', {'pid': 1, 'label': 'Wohoo'}) }}

Refactoring T3TWIG

Ich finde das cObject T3TWIG sollte etwas umstruktiert werden und sich mehr an FLUIDTEMPLATE orientieren. Folgende Punkte sollten meiner Ansicht nach angepasst werden:

  • Umbenennung in TWIGTEMPLATE
  • Die Templatedatei sollte mit file konfiguriert werden
  • Die Daten für den Twig-Context sollten unterhalb von context abgegeben werden

Das würde dann so aussehen:

page = PAGE
page.10 = TWIGTEMPLATE
page.10 {
  file = path/to/template.twig
  context {
    logo =< lib.page.logo
    menu =< lib.page.mymenu
  }
}

add extbase view

There should be a view for an extbase controller.
Maybe rn_base should be optional.

Remove BaseTwigAction

Remove BaseTwigAction so that it's possible to replace only the ViewClassName in BaseIOC - Actions to render the template via twig.

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.