Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Field Formatter Template

Security covered Drupal 9–11
View on drupal.org

Description
--------------------------
Field Formatter Template (FFT) allow you can easy create formatter template for any field.

Installation
--------------------------
1. Copy the entire fft directory the Drupal sites/all/modules for Drupal 7 and modules/contrib for Drupal 8
directory or use Drush with drush dl fft.
2. Login as an administrator. Enable the module on the Modules page.

Usage Drupal 8
--------------------------
- Create your template, default formatter template store in folder
'sites/all/formatter', you can change this folder at 'admin/config/content/fft'.
Formatter template create as normal twig template, example you create inline tags
template, create file with name 'fft-inline-tags.html.twig' in folder
'sites/all/formatter' open file and type:

{#Template Name: Inline Tags#}
{#Settings:
delimiter = >>
#}

{% set values = [] %}

{% for item in data %}
    {% set term = link(item.name.value, 'internal:/taxonomy/term/' ~ item.tid.value)|render %}
    {% set values = values|merge([term]) %}
{% endfor %}

<div>{{ values | join(' ' ~ settings.delimiter ~ ' ') | raw }}</div>

Now open "Manage Display" of a content type, chose any field and chose
"Formatter Template" you can config and select "Inline Tags". Your field
formatter will display with 'fft-inline-tags.html.twig'. Variables you can use in
template is data and entity
- data: stored all data of selected field.
- entity: attached entity of field.
- settings: settings extras for template.

Clear cache after settings to make effect.

Note for Drupal 8:
Twig template for field must start with prefix fft
Example:
fft-inline-tags.html.twig
fft-flexslider.html.twig

Usage Drupal 7
--------------------------
- Create your template, default formatter template store in folder
'sites/all/formatter', you can change this folder at 'admin/config/content/fft'.
Formatter template create as normal tpl template, example you create inline tags template, create file with name 'fft-inline-tags.tpl.php' in folder 'sites/all/formatter'
open file and type:

<?php
/*Template Name: Inline Tags*/
 
// dpm($data);
$tags = array();
foreach ($data as $key => $item) {
$tags[] = l($item['name'], "taxonomy/term/" . $item['tid']);
}
 
print implode(" | ", $tags);
?>

Now open "Manage Display" of a content type, chose any field and chose
"Formatter Template" you can config and select "Inline Tags". Your field
formatter will display with 'fft-inline-tags.tpl.php'. Variables you can use in
template is $data and $entity
- $data: stored all data of selected field.
- $entity: attached entity of field.
- $settings: settings extras for template.

Example templates
--------------------------
Inline Taxonomy Term: display inline taxonomy term for Term reference field.
Slideshow FlexSlider: display image as slideshow with FlexSlider.
Thumbnail Slideshow FlexSlider: display image as thumbnail slideshow with FlexSlider.
CarouFredSel: display slideshow with CarouFredSel.
Owl Carousel: Slideshow with Owl Carousel.

Video
--------------------------
Video intro how to use FFT: https://www.youtube.com/watch?v=kF-Sa86VEtM

Video create FlexSlider formatter with FFT: https://www.youtube.com/watch?v=Yn2373Qftfg

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Jun 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Slowing

Release Timeline

Releases

Version Type Core Release date
3.0.1 Stable 9–11 Sep 23, 2024
3.0.0 Stable Sep 12, 2023
3.0.1-beta1 Pre-release Jun 20, 2023