custom fields in joomla

21
Custom Fields in Joomla Presented at Sydney Joomla User Group 14 th June 2016 By Tim Plummer

Upload: tim-plummer

Post on 20-Jan-2017

163 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Custom fields in joomla

Custom Fields in Joomla

Presented at Sydney Joomla User Group 14th June 2016

By Tim Plummer

Page 2: Custom fields in joomla

What are custom fields?

• Allow you to add your own pieces of information to Joomla content

Page 3: Custom fields in joomla

Joomla 3.7

• It is planned that custom fields (com_fields) will be added to Joomla core in version 3.7 later this year.– Based on DP Fields (third party extension by

Digital Peak)– https://github.com/joomla-projects/custom-fields– https://joomla.digital-peak.com/blog/198-custom-

fields-in-joomla-3-6

Page 4: Custom fields in joomla

Concept of DP Fields

• It’s not a CCK• It’s not a standalone component• Works like com_categories• Can be integrated with third party extensions

Page 5: Custom fields in joomla

What is DP Fields?

• Is a component and a system plugin• Extends Jform• Users JFormFields• Is MVC coded• Uses JLayouts

Page 6: Custom fields in joomla

Installation

• DP Fields can be installed like any other third party extension

Page 7: Custom fields in joomla

System plugin

System plugin should be automatically enabled during install

Page 8: Custom fields in joomla

Where to find it?

Does not appear in components menuBut in article manager, you will see two new views

Page 9: Custom fields in joomla

Creating a field

Need to enter a title, select type, and enter a label

Page 10: Custom fields in joomla

Using custom fields

• In any article, you will now see the fields tab with your custom fields

Page 11: Custom fields in joomla

Displaying custom fields

• If data entered in field, it will automatically appear at top of article

Page 12: Custom fields in joomla

How to control where field appears

• To specify where in the article the field appears, you can use

{{#dpfields}} {{label}}:{{{value}}} {{/dpfields}}

Page 13: Custom fields in joomla

To stop fields appearing twice

• Create a field with alias disable-default-rendering, type=Yes No, Default value=Yes

Page 14: Custom fields in joomla

Now field only appears once

Page 15: Custom fields in joomla

Inserting individual fields

• You can use the editor Insert field button if you want to insert individual fields in different places in your article rather than all together

Page 16: Custom fields in joomla

For developer

• To integrate into your extension– Add menu item sidebar– Fields added to form during

onContentPrepareForm– Fields are saved through onContentAfterSave

event

Page 17: Custom fields in joomla

Versioning

• No versioning in com_fields (going into core), but may be added in future. Original DP Fields does have versioning.

Page 18: Custom fields in joomla

Something to be aware of

• After you save field the first time, the type cannot be changed.

Page 19: Custom fields in joomla

Can I search custom fields?

• Basic search needs a join, look at the plg_search_content plugin

• Smart search is automatically supported

Page 20: Custom fields in joomla

Questions?

Page 21: Custom fields in joomla

Tim Plummerwww.tamlynsoftware.com

@bfsurvey