Is there a need for basic custom fields in Joomla core?

397 views
Skip to first unread message

Allon Moritz

unread,
Aug 26, 2015, 1:31:04 AM8/26/15
to joomla-de...@googlegroups.com
Hello together
For our extensions at Digital Peak we a needed custom fields feature. To not duplicate code we created DPFields, a component and plugin which can be integrated into existing components the same way as com_categories. For example it works out of the box with the article and user manager. Additionally we adapted the com_helloworld example with two simple commits to illustrate how it can be integrated. More information about the integration into your component can be found in the developer documentation.

DPFields is not a full blown CCK, it can be seen more as a UI for Joomla form fields. It prepares an XML string which is loaded into the for on onContentPrepareForm. If you want to give it a try, you can download it from here, the getting started guide will help to install it and set up your first field.

After some internal discussion we thought if the Joomla community is interested to add it to the Joomla core we would prepare a PR. So our question to you, is there a need for it?

Regards
the Digital Peak team

Fedir

unread,
Aug 26, 2015, 4:28:44 AM8/26/15
to Joomla! General Development
looks good,
but personally, it is not the way I would like to see custom fields in Joomla ;)

I think, it is better if your team continue stand alone development, so you will have more freedom to do updates and improvements ;)

середа, 26 серпня 2015 р. 08:31:04 UTC+3 користувач laoneo написав:

Allon Moritz

unread,
Aug 26, 2015, 4:31:20 AM8/26/15
to joomla-de...@googlegroups.com
How would you have then custom fields in Joomla? Always eager to hear other opinions.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

Bakual

unread,
Aug 26, 2015, 5:00:07 AM8/26/15
to Joomla! General Development
Sounds a bit like http://www.fieldsattach.com/ from the description?

I think having some basic, user friendly solution for Joomla would be nice to have. It's requested every now and then.

Allon Moritz

unread,
Aug 26, 2015, 5:48:31 AM8/26/15
to joomla-de...@googlegroups.com
Under the hood it's totally different than fieldsattach. It uses JForm to add the fields and not some javascript to add the tabs and fields.

It is lightweight and uses only Joomla default events.

--

Rick Spaan - R2H

unread,
Aug 26, 2015, 6:23:31 AM8/26/15
to Joomla! General Development
I don't know if core integration is the way to go. It adds a lot of functionality to the core which is rather powerful but could be overwhelming for the "simple" user.
Either way, I thinks it's a great extension as if it makes his way to the core it is welcomed by me!

Op woensdag 26 augustus 2015 10:28:44 UTC+2 schreef Fedir:

Bakual

unread,
Aug 26, 2015, 7:12:14 AM8/26/15
to Joomla! General Development
I never looked at the actual code of fieldsattach. Just saw the presentation from Brian at JaB last year.


Am Mittwoch, 26. August 2015 11:48:31 UTC+2 schrieb laoneo:
Under the hood it's totally different than fieldsattach. It uses JForm to add the fields and not some javascript to add the tabs and fields.

It is lightweight and uses only Joomla default events.
On Wed, Aug 26, 2015 at 11:00 AM, Bakual <werbe...@bakual.ch> wrote:
Sounds a bit like http://www.fieldsattach.com/ from the description?

I think having some basic, user friendly solution for Joomla would be nice to have. It's requested every now and then.

Am Mittwoch, 26. August 2015 07:31:04 UTC+2 schrieb laoneo:
Hello together
For our extensions at Digital Peak we a needed custom fields feature. To not duplicate code we created DPFields, a component and plugin which can be integrated into existing components the same way as com_categories. For example it works out of the box with the article and user manager. Additionally we adapted the com_helloworld example with two simple commits to illustrate how it can be integrated. More information about the integration into your component can be found in the developer documentation.

DPFields is not a full blown CCK, it can be seen more as a UI for Joomla form fields. It prepares an XML string which is loaded into the for on onContentPrepareForm. If you want to give it a try, you can download it from here, the getting started guide will help to install it and set up your first field.

After some internal discussion we thought if the Joomla community is interested to add it to the Joomla core we would prepare a PR. So our question to you, is there a need for it?

Regards
the Digital Peak team

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-dev-general@googlegroups.com.

Janich Rasmussen

unread,
Aug 26, 2015, 7:25:25 AM8/26/15
to Joomla! General Development
There is a need for it alright, but I find it to be a developers need, not a user need.
The reason is simple: Once you built your custom fields, you need template customisation aka code!
And users expect that things "just work". 

Example: I often help people tweak K2 pages to fit the extrafields they created themselves, and it's almost always the same:
The user ends up blaming the CMS (Joomla - not K2!) for being inflexible (as they don't know how to code the templates).
Therefore, I see the templates as the big issue for the end users.

For a CCK (like Seblod/Sobipro/etc), they have premade templates, but with a core CCK, there would be none.

From a developers point of view, I'd say yeah, there is a need, but the code needs to be lightweight and flexible, and it has to come with an easy interface to use from a backend (for me to even consider it).
Personally I wouldn't recommend Fieldsattach. 
It's very attractive on the UI and features, but it has (or have had - I used it 6 months ago) some issues with the code, loading performance and filtering pages.

If that got fixed, it would certainly be interesting. And the same for alternatives.

Allon Moritz

unread,
Aug 26, 2015, 7:35:19 AM8/26/15
to joomla-de...@googlegroups.com
The approach we took on DPFields is to use layouts. The default layout fits into the layout of articles
Inline image 1

The component developer can override the layout then by adding it's own layout to render a field by adding  a file to the folder components/com_foo/layouts/field/render.php. And finally the template itself can override the layout too when there is a need for it. DPFields itself has only two files in it's site folder, no views, controllers, javascript files or models. The layout to render all the fields and to render a single field. Like that the component developer has full control of the field rendering and can adapt it to his needs.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

brian teeman

unread,
Aug 26, 2015, 7:41:12 AM8/26/15
to Joomla! General Development
Not looked at the code but I would LOVE to see something "like" this in the core.

(Fieldsattach works great but it doesnt use the core Jform etc)

Allon Moritz

unread,
Aug 26, 2015, 7:54:16 AM8/26/15
to joomla-de...@googlegroups.com
That's why we made DPFields. It looks like it belongs to Joomla. If you want, you can have a look on our demo site https://joomla.digital-peak.com/demo/dpc/administrator. You can log in with demo/demo. It showcases the integration into DPCalendar. But it looks the same as for Articles and the user manager.

On Wed, Aug 26, 2015 at 1:41 PM, brian teeman <joom...@googlemail.com> wrote:
Not looked at the code but I would LOVE to see something "like" this in the core.

(Fieldsattach works great but it doesnt use the core Jform etc)

--

Niels Braczek

unread,
Aug 26, 2015, 9:02:57 AM8/26/15
to joomla-de...@googlegroups.com
Am 26.08.2015 um 07:30 schrieb Allon Moritz:

> After some internal discussion we thought if the Joomla community is
> interested to add it to the Joomla core we would prepare a PR. So our
> question to you, is there a need for it?

Great job! This is the best approach to custom fields that I've seen so
far. So, here is a clear +1 from me. The only thing I'm missing is a
reasonable test coverage.

Regards,
Niels

--
| New Stars on the Horizon: GreenCape · nibralab · laJoom |
| http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------

Troy

unread,
Aug 27, 2015, 10:53:29 AM8/27/15
to joomla-de...@googlegroups.com

Error

You are not authorised to view this resource.
when visiting "fields" tab LOL

Bear

laoneo

unread,
Aug 28, 2015, 5:03:58 AM8/28/15
to Joomla! General Development
Please open an issue on the tracker https://github.com/Digital-Peak/DPFields/issues if you think you have found a bug...


On Thursday, August 27, 2015 at 4:53:29 PM UTC+2, Bear wrote:

Error

You are not authorised to view this resource.
when visiting "fields" tab LOL

Bear
On 8/26/2015 06:53, Allon Moritz wrote:
That's why we made DPFields. It looks like it belongs to Joomla. If you want, you can have a look on our demo site https://joomla.digital-peak.com/demo/dpc/administrator. You can log in with demo/demo. It showcases the integration into DPCalendar. But it looks the same as for Articles and the user manager.
On Wed, Aug 26, 2015 at 1:41 PM, brian teeman <joom...@googlemail.com> wrote:
Not looked at the code but I would LOVE to see something "like" this in the core.

(Fieldsattach works great but it doesnt use the core Jform etc)
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Richard Hellyer

unread,
Oct 10, 2015, 11:23:35 PM10/10/15
to Joomla! General Development
I really like this approach and had a couple of quick questions as I'd like to try this in a website I am presently developing for a user:

1. could I programatically add custom field content to existing articles (eg. if I have a set of book articles and know each books pagecount, would it be relatively straightforward to write a php program to update the custom fields for each of the book articles?)
2. I'd like to create lists of articles filtered by a custom field and was considering writing a module for this (eg. to create a list of book articles where the pagecount was greater than 400 say) ... how would I do this?

I agree with other comments here that support this being a part of core joomla in some form. My clients can't reconcile having their content stored in a database, but without the ability to simply add content fields (not to mention that they mention that WP already has this built in .. aargh :( )

Richard

Ove Eriksson

unread,
Oct 11, 2015, 1:00:09 PM10/11/15
to Joomla! General Development

+1 for adding "basic custom fields in Joomla core" as a "Core extension" in Github

I've tested it as is with com_content and have added it to my own code. If you want me to somewhere else confirm that this works, please let me know.
One point - It would be better to add the menu item "Extra fields" below and not above the article entry.

I came across this Joomla 4 architecture sprint and the idea  of "Orthogonal Component structure" . I would call  it "Horizontal extensions"
Mentioned are ACL, versioning, translating, tagging, commenting. i.e extensions that a developer can add to/use in his 3.pty code.
This custom fields solution belongs to the core supported extensions like also the revised media manager and the categories. To me the

DPAttachments extension would be another great candidate.


@Richard
1. If you add a field to the Article data, you can edit the Book articles with the normal edit views. In your case No of pages.If you have other articles then about books I guess you have to manipulate/override the output of the field.   .
2. There is no problem listing those articles. You just have to create a Sql query in your module selecting the article and the extra field data.
 

Ove

Allon Moritz

unread,
Oct 11, 2015, 1:04:45 PM10/11/15
to joomla-de...@googlegroups.com
As long as it is not integrated into core it is the only way to attach it to the sidebar as the first item.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Ove Eriksson

unread,
Oct 11, 2015, 2:37:09 PM10/11/15
to Joomla! General Development
That was my guess! There is a hook missing in the core.
Another idea. Is it possible and usefull to add it to the left menu on the Joomla Dashboard instead? The "Extra fields" maintenance is normaly a one time event.
A quickicon plug-in would do that. That plug-in could probably even better be unpublished on a live site.  Or is the module quickicon maybee too much template dependent?

I'm only tying to get that menu entry out of the way in the normal article handling situation.

Richard Hellyer

unread,
Oct 11, 2015, 5:24:08 PM10/11/15
to Joomla! General Development
Thanks for that Ove - I'll try the sql query approach (though it may stretch my query development skills as I would like to also select by a category :)

With respect to updating the articles, I have several thousand pre-existing articles to which I would need to add an extra field. I was hoping to be able to write a php script to do that, and I imagine that will be possible if the database supporting the extension isn't too complicated. (I had previously tried doing this with the tag component but it seemed fraught with gotchas)

Allon Moritz

unread,
Oct 12, 2015, 3:30:43 AM10/12/15
to joomla-de...@googlegroups.com
I will soon create a PR to include DPFields into Joomla 3.. When it will be part of Joomla core, then the menu item can be insert on the proper place. Will publish the link to the PR here when it is ready to test.

YOu can create a custom field for the module setting a number of articles and in your module override you can access that field and fetch the articles based on the amount of articles in that field.

--

Ove Eriksson

unread,
Oct 12, 2015, 3:38:04 AM10/12/15
to Joomla! General Development
@Richard

If you open a new topic here or in the J! developer forum and add more information about your case, I'm sure someone can give some hints.

The "extra fiield" is not the problem: Other issues like where you get the article-id and  number of book pages from or what you can hardcode in the sql query might be harder to handle. You have to know and use  --> the field.id, context = "com_content.article", item_id = article-id,.value = your number of pages.

The complexity of the Joomla tags is completelly something else.

Ove

Allon Moritz

unread,
Oct 12, 2015, 4:50:41 AM10/12/15
to joomla-de...@googlegroups.com
@Richard if you are in a Joomla request you can do it like I did it in the System plugin. Using the model to set the value as you can see it here https://github.com/Digital-Peak/DPFields/blob/master/plg_system_dpfields/dpfields.php#L246. Or you can just fire the onContentBefor/AfterSave events, when you have the list of articles.

Ove Eriksson

unread,
Oct 12, 2015, 11:45:23 AM10/12/15
to Joomla! General Development
@laoneo

I've tested a little more.

Can you give me/us a nice example when to add the extra fields into the text area of an article. I can't find situations where this would be used.

The user has to toggle the editor and enter something like this, where he has to know the field id's or the field alias. .
<ol>
{{#dpfields 5,1}}
	<li>Field Label is <b>{{label}}</b> and the value is <br /><b>{{{value}}}</b></li>
{{/dpfields}}
</ol>

At the same time the "normal" field rendering has to be blocked.

I'm not convinced that this is needed for the core "Extra fields" extension. Especially since a lot of code
from an external Mustache library is used for the rendering.

Wouldn't it be better to keep that in a third party content plug in? For special cases?


Ove



pepperstreet

unread,
Jan 22, 2016, 8:34:38 PM1/22/16
to Joomla! General Development
Am Mittwoch, 26. August 2015 07:31:04 UTC+2 schrieb laoneo:
if the Joomla community is interested to add it to the Joomla core we would prepare a PR. So our question to you, is there a need for it?

Hell, YES!!! ;) 

laoneo

unread,
Mar 31, 2016, 9:02:55 AM3/31/16
to Joomla! General Development
I want to give a little update about the custom fields feature for Joomla 3.6. After the pull request https://github.com/joomla/joomla-cms/pull/9452 got a bit of attention, the development has moved to the repository https://github.com/joomla-projects/custom-fields. Please help to test it out and open an issue or create a pull request there if you think something needs to change, The target is that we can make it ready for community testing and integrate it into Joomla 3.6. More detailed information how to test it can be found on that blog post https://joomla.digital-peak.com/blog/198-custom-fields-in-joomla-3-6. Don't hesitate to leave feedback as we need ALL to make a kickass custom fields feature for Joomla 3.6.

Walt Sorensen

unread,
Mar 31, 2016, 12:04:16 PM3/31/16
to Joomla! General Development
You might want to bring this feature up in the CMS development mailing list https://groups.google.com/forum/#!forum/joomla-dev-cms

Nicolas OLIVIER

unread,
Mar 31, 2016, 4:43:03 PM3/31/16
to Joomla! General Development
As a long time (french) user of all sort of custom field (hand made, all CCK...) My clients needs are quite everytime the sames :
  • group of custom fields on specific category (or all of course)
  • custom fields in the main tab not a specific tab (Seblod is the best for that)
  • a simple gallery fields because clients don't want to use slides module to insert them in articles
  • simplicity for us to integrate quickly these custom fields in our com_content override like <span>$this->fields[1]</span> (Seblod is not the best for that ^^)
  • module for adding some filters on pages on the custom fields
  • com_content menu links using the custom fields for ordering or filtering

That's a good start ^^

Troy Hall

unread,
Mar 31, 2016, 8:49:08 PM3/31/16
to joomla-de...@googlegroups.com
count me in
Bear


On 3/31/2016 08:02, laoneo wrote:
I want to give a little update about the custom fields feature for Joomla 3.6. After the pull request https://github.com/joomla/joomla-cms/pull/9452 got a bit of attention, the development has moved to the repository https://github.com/joomla-projects/custom-fields. Please help to test it out and open an issue or create a pull request there if you think something needs to change, The target is that we can make it ready for community testing and integrate it into Joomla 3.6. More detailed information how to test it can be found on that blog post https://joomla.digital-peak.com/blog/198-custom-fields-in-joomla-3-6. Don't hesitate to leave feedback as we need ALL to make a kickass custom fields feature for Joomla 3.6.
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Troy Hall

unread,
Mar 31, 2016, 8:50:57 PM3/31/16
to joomla-de...@googlegroups.com
ALL article views, categorie(s), blog, etc should have at least one custom field ability.  Read Only ability would be good too.
Bear
--

Allon Moritz

unread,
Apr 1, 2016, 2:18:17 AM4/1/16
to joomla-de...@googlegroups.com
  • group of custom fields on specific category (or all of course)
  • Already possible.
  • custom fields in the main tab not a specific tab (Seblod is the best for that)
  • Can be done with a layout override. If needed open an issue, needs to be discussed how this should be implemented.
  • a simple gallery fields because clients don't want to use slides module to insert them in articles
  • Already possible.
  • simplicity for us to integrate quickly these custom fields in our com_content override like <span>$this->fields[1]</span> (Seblod is not the best for that ^^)
  • Already possible $this->item->fields.
  • module for adding some filters on pages on the custom fields
  • Needs to be done.
  • com_content menu links using the custom fields for ordering or filtering
  • Difficult to do.
Reply all
Reply to author
Forward
0 new messages