Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/typo3gmbh/symfony-template-bundle
INTERNAL: Symfony Template Bundle for TYPO3 Applications
https://github.com/typo3gmbh/symfony-template-bundle
symfony symfony-bundle
Last synced: 12 days ago
JSON representation
INTERNAL: Symfony Template Bundle for TYPO3 Applications
- Host: GitHub
- URL: https://github.com/typo3gmbh/symfony-template-bundle
- Owner: TYPO3GmbH
- License: mit
- Created: 2019-12-11T10:38:57.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-16T14:13:57.000Z (19 days ago)
- Last Synced: 2024-12-16T15:28:58.959Z (19 days ago)
- Topics: symfony, symfony-bundle
- Language: Twig
- Homepage:
- Size: 17.3 MB
- Stars: 4
- Watchers: 6
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Symfony Template Bundle
This package is used across various TYPO3 Symfony Applications to ensure a streamlined visual experience and reduced maintenance.
- [Symfony Template Bundle](#symfony-template-bundle)
- [Installation](#installation)
- [Configuration](#configuration)
- [Encore](#encore)
- [Extending Menus](#extending-menus)
- [Dividing Menus](#dividing-menus)
- [Page Template](#page-template)
- [Available Blocks](#available-blocks)
- [`title`](#title)
- [`headline`](#headline)
- [`body`](#body)
- [`footer`](#footer)
- [`stylesheets`](#stylesheets)
- [`javascripts`](#javascripts)
- [EMail Template](#email-template)
- [Available Blocks](#available-blocks-1)
- [`email_subject`](#email_subject)
- [`email_plaintext`](#email_plaintext)
- [`email_html_preview`](#email_html_preview)
- [`email_html_body`](#email_html_body)
- [Utilities](#utilities)
- [AvatarUtility::getAvatar(string $email, int $size)](#avatarutilitygetavatarstring-email-int-size)
- [AvatarUtility::getAvatarUrl(string $email, int $size)](#avatarutilitygetavatarurlstring-email-int-size)
- [Twig Extensions](#twig-extensions)
- [AutolinkExtension](#autolinkextension)
- [`autolink`](#autolink)
- [AvatarExtension](#avatarextension)
- [`avatar`](#avatar)
- [IconExtension](#iconextension)
- [`icon`](#icon)
- [MarkdownExtension](#markdownextension)
- [`markdown`](#markdown)
- [TemplateExtension](#templateextension)
- [`template_function_exist`](#template_function_exist)
- [`template_function_call`](#template_function_call)
- [DateTimeExtension](#datetimeextension)
- [`to_datetime`](#to_datetime)
- [`localdate`](#localdate)
- [`localdatetime`](#localdatetime)
- [`relativetime`](#relativetime)
- [`timediff`](#timediff)
- [Twig Tags](#twig-tags)
- [`frame`](#frame)
- [Usage](#usage)
- [Example](#example)
- [`expand`](#expand)
- [Usage](#usage-1)
- [Example](#example-1)
- [JavaScript Libraries](#javascript-libraries)
- [Datepicker](#datepicker)
- [Choices](#choices)
- [Taginput](#taginput)# Installation
```console
composer require t3g/symfony-template-bundle
```Ensure that symfony default scripts are present in your `composer.json` file.
```json
{
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
}
}
```# Configuration
The bundle comes with a sensible default configuration, which is listed below.
You can define these options if you need to change them:```yaml
# config/packages/template.yaml
template:
application:
# Example: Intercept
name: 'Template Bundle'
# Example: intercept
platformkey: ~
copyright:
author: TYPO3 GmbH
url: https://typo3.com
routes:
# Example: app_index
home: app_index
privacy: https://typo3.com/privacy-policy
legal: https://typo3.com/legal-notice
feedback: https://support.typo3.com
menu:
# Example: App\Menu\MenuBuilder
class: T3G\Bundle\TemplateBundle\Menu\MenuBuilder
assets:
# Example: app
encore_entrypoint: ~
email:
legal_footer: |
TYPO3 GmbH, Emanuel-Leutze-Straße 11, DE-40547 Düsseldorf, Germany
Phone: +49 (0)211 20 54 36 0, Web: www.typo3.com, Email: [email protected]Court of registration: Amtsgericht Düsseldorf HRB 77950
CEO: Daniel Fau, (CTO & Procuration) Frank Nägler
Supervisory Board: Olivier Dobberkau, Ric van Westhreenen, Stefan Busemann
theme:
# Example: md
navbar_breakpoint: lg
use_logo: false
background: light
``````console
bin/console config:dump-reference template
```Configuration will be available within the templates and can be accessed through `template` variable.
Examples:
```twig
{% block title %}{% endblock %} - {{ template.application.name }}
``````twig
{{ template.application.name }}
```## Encore
```console
composer require symfony/webpack-encore-bundle
```To enable your encore entrypoint simply configure the key within the yaml configuration.
```yaml
# config/packages/template.yaml
template:
application:
assets:
encore_entrypoint: app
```## Extending Menus
```yaml
# config/packages/template.yml
template:
application:
menu:
class: App\Menu\MenuBuilder
``````php
addChild(
'home',
[
'route' => 'app_index',
'label' => 'Home',
'extras' => [
'icon' => 'home',
],
]
);
return $menu;
}
}
```Available methods to override `mainDefault`, `mainProfile` and `mainFooter`.
### Dividing Menus
```php
$menu->addChild($this->getDivider());
```# Page Template
Extend Default Layout
```twig
{% extends '@Template/layout.html.twig' %}
```## Available Blocks
### `title`
```twig
{% block title %}Home{% endblock %}
``````html
Home - {{ template.application.name }}
```### `headline`
This block will **only** be rendered obove the body block if defined in the template.
```twig
{% block headline %}Super Headline{% endblock %}
``````html
Super Headline
```### `body`
```twig
{% block body %}
BODY CONTENT
{% endblock %}
``````html
BODY CONTENT
```### `footer`
```twig
{% block footer %}
FOOTER CONTENT
{% endblock %}
``````html
FOOTER CONTENT
```### `stylesheets`
Stylesheet block will be rendered after the `base` and `encore` css before the closing ``.
### `javascripts`
JavaScript block will be rendered after `base` and `encore` javascript before the closing `