There may be contrib modules to do that, but a very simple way to do this is to override the field template, and putting that file in your themes/MY_THEME/templates folder.
For example, to override the body field template, you should put your code in a file called field--body.tpl.php and place it in core/theme/basis/templates, or if you are using another theme, in themes/MY_THEME/templates.
You can see an example of the default code that Backdrop uses to theme fields by looking at core/modules/field/templates/field.tpl.php, (also here) but please notice that THAT particular template is not used - it's there as an example to help you override the field templates.
Also, take a look at the different patterns you can use to override fields in specific content types by looking at this help text.
I've installed the Field Wrappers module, and I can see the option to wrap a field in views, but I cannot see any options to wrap a field in my layout?
Graham Leach: Has anyone got any experience with the assets in this area of Backdrop CMS?
filetransfer.inc
ftp.inc
local.inc
ssh.inc
If you do, I'd love to chat with you...
Graham...
Posted1 hour 7 min ago by Graham Leach (Graham Leach) on:
I've been building Backdrop sites since 2021 with the first being my own:
https://www.systemhorizons.co.uk/
Two over time for one client:
https://www....
Posted1 hour 50 min ago by Martin Price | System Horizons Ltd (yorkshirepudding) on:
Hi Tim. Yes I think at the moment it needs custom code. Depending where you want the class it could be either:
/**
* Implements hook_preprocess_page().
*/
function theme_name_preprocess_page...
Posted2 hours 22 min ago by Martin Price | System Horizons Ltd (yorkshirepudding) on:
With the threat of Drupal 7 EOL looming, and a very out of date Drupal 6 site that no longer worked with newer php versions, I made the decision to move both sites to Backdrop in March 2024. ...
Happy Birthday Backdrop CMS! Thanks to the team for everything you do and I'm glad to be part of the people who have been using this system since version 1.1 :))
I have built more than 100...
Posted15 hours 6 min ago by Antony Milenkov (amilenkov) on:
Comments
There may be contrib modules to do that, but a very simple way to do this is to override the field template, and putting that file in your
themes/MY_THEME/templates
folder.For example, to override the body field template, you should put your code in a file called
field--body.tpl.php
and place it incore/theme/basis/templates
, or if you are using another theme, inthemes/MY_THEME/templates
.You can see an example of the default code that Backdrop uses to theme fields by looking at
core/modules/field/templates/field.tpl.php
, (also here) but please notice that THAT particular template is not used - it's there as an example to help you override the field templates.Also, take a look at the different patterns you can use to override fields in specific content types by looking at this help text.
The Field Wrappers module is very easy to extend to add the wrappers you need. There is an example in the wiki and in the API.php file in the module.
I've installed the Field Wrappers module, and I can see the option to wrap a field in views, but I cannot see any options to wrap a field in my layout?
Hi @kgolding. You go to "manage display" for the content type and it is part of the configuration for the field.