We moved to new unified forum!

Please post all new support queries in our New Forum.

T3 Community Discussion & Support

Let's build the best free Joomla template framework, together!
  1. Eugen
  2. General Discussion
  3. Sunday, 07 September 2014
  4.  Subscribe via email
Hi,

i need some help for creating an extra field...

1. I've created the override of com_content so i got "template/html/com_content/article with 3 files. default.xml, default.php and default_links.php
2. default.php needs to be modified where i can read my parameter: (http://t3-framework.org/documentation/extend-com-content.html#add-extra-fields)
2.1 $attribs = new JRegistry($this->item->attribs);
2.2 <?php if ($attribs->get('extra-field-name')) : ?> logic <?php endif ?>

The question is now, where i should put my custom fieldset with the field? I mean i need to register this field anywhere....

If i put it to default.xml (template/html/com_content/article/default.xml) i can't see anything in my article. No extra tab.

<fields name="attribs">
<fieldset name="extra-field-group-name" label="test" description="test" group="extrafields">
<field name="extra-field-name" type="text" default="" label="test" description="test">
</field>
</fieldset>
</fields>

Thanks,
Eugen
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Thanks a lot Gardner,

i'll waiting for more informations...

Eugen
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Eugen,

Yeah, actually, I am little confused also. I will pass this our developer who can explain this more clearly.

Gardner.
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
after some debugging i think i found the problem but not the solution.

Getting value from custom extra field works only if you override the components and not layouts (screenshot). But in my case i need to override the layout of content because i'm working with article blogs and the page header (h2) is located in "/html/layouts/joomla/content/blog_style_default_item_title.php"

Bug or not, it will be nice to solve this problem...

Regards,
Eugen
Attachments (2)
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 3
Accepted Answer Pending Moderation
0
Votes
Undo
No help? :(
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 4
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Luna,

your solution works fine but now i can't get the value from my extra field.

<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="attribs">
<fieldset name="icon-class-fieldset" label="Icon Class" description="" group="extrafields">
<field name="icon-class-field" type="text" default="" class="" label="Icon Class" />
</fieldset>
</fields>
</form>

I've created the override for layout-->content (need the page title). After this just registered $attribs = new JRegistry($this->item->attribs);

If i now try to get the value, nothings happens.... See the image

Regards,
Eugen
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 5
Accepted Answer Pending Moderation
0
Votes
Undo
Hi again,

Please replace the code in your .xml file with:

<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="attribs">
<fieldset name="icon-class-field" label="Icon Class" description="icon class" group="extrafields">
<field name="icon-class" type="text" default="" class="" label="Icon Class" />
</fieldset>
</fields>
</form>


Check the article edit form in the screenshot below: http://easycaptures.com/fs/uploaded/851/9097745053.jpg

Gardner.
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 6
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Eugen

Let me take time to duplicate your case from my side and back to you later with solution :)

Gardner.
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 7
Accepted Answer Pending Moderation
0
Votes
Undo
Hmmm i think i miss something again....

1. article-extrafield.xml with the field:

<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="extrafields">
<fieldset name="icon-class-fieldset" label="icon class" description="icon class" group="extrafields">
<field name="icon-class" type="text" default="" label="icon class"/>
</fieldset>
</fields>
</form>

2. assigned it to extra field group in the category setting panel (image)
3. in template/html/com_content/article/default.php --> $attribs = new JRegistry($this->item->attribs);

but still no extra tab in the article. What is wrong?
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 8
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Eugen,

You missed some steps in the documentation.

1. Create extra field group by adding an .xml file to the folder: templates\t3_bs3_blank\etc\extrafields (article-extrafield.xml)
2. Define extra fields in the file
<fields="extrafields">
<fieldset name="extra-field-group-name" label="test" description="test" group="extrafields">
<field name="extra-field-name" type="text" default="" label="test" description="test">
</field>
</fieldset>
</fields>

3. Get extra fields for the overridden layout: template/html/com_content/article/default.xml
$attribs = new JRegistry($this->item->attribs);

4. In the category setting panel, assign it to extra field group
5. In the article configuration of the category that you assigned extra field group for, you will see list of extra fields that you added in the article-extrafield.xml

Gardner.
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 9
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.