hoanhung191290
hoanhung191290

Reputation: 11

Pass parameter to custom field in joomla

I create a custom field which gets related people,subjects of an article when I edit it.I want to pass the category id of this article , but I can't figure out how to do it. Below is my code: In article.xml

<fields name="idn_tags">
        <field name="idn_tags_people" type="IdnTagsPeopleCheckboxes" />
        <field name="idn_tags_subject" type="IdnTagsSubjectCheckboxes" />
</fields>

In edit.php

<?php echo $this->form->getInput('idn_tags_people','idn_tags'); ?>
<?php echo $this->form->getInput('idn_tags_subject','idn_tags'); ?>

In every class IdnTagsPeopleCheckboxes and IdnTagsSubjectCheckboxes I want to pass category id of current article to get only people, subjects of this category which article maybe tagged.

Upvotes: 1

Views: 1281

Answers (2)

Pham Quang
Pham Quang

Reputation: 128

Ok! Just do this:

<?php $this->form->setValue('idn_tags_people','idn_tags', $[Your Value]); ?>
<?php echo $this->form->getInput('idn_tags_people','idn_tags'); ?>

Upvotes: 0

Techie
Techie

Reputation: 45124

Joomla has already covered adding custom fields to the article component Read this. If you have any issues let me know. Read this as well.

Upvotes: 1

Related Questions