Keyword

How to create a new custom Extrafield-Type?

  • Florian Martin
  • Florian Martin's Avatar Topic Author
  • Offline
  • New Member
More
1 week 4 days ago #178600 by Florian Martin
How to create a new custom Extrafield-Type? was created by Florian Martin
Hi.

I try to find out how to create a new extrafield-type. In my example i need an extrafield which do an sql-query and give me the result as a dropdown, similar to the JoomlaCore-Fields: docs.joomla.org/J3.x:Adding_custom_fields/Sql_Field

Does anybody know which files I have to change (or create new)?

Thanx

Please Log in or Create an account to join the conversation.

  • Florian Martin
  • Florian Martin's Avatar Topic Author
  • Offline
  • New Member
More
1 week 4 days ago #178601 by Florian Martin
Replied by Florian Martin on topic How to create a new custom Extrafield-Type?
Or - where can I change the output of "$extraField->element"?

I just need the pure value without the generated input-field/HTML-Tag.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
5 days 11 hours ago #178635 by Fotis
You can't create custom extra fields. Only K2 plugins. Find the K2 Example plugin on github.com/getk2/ and star with that. Since it's a plugin, you can create anything you like, even custom fields for the item (and other) forms.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Florian Martin
  • Florian Martin's Avatar Topic Author
  • Offline
  • New Member
More
3 days 15 hours ago #178681 by Florian Martin
Replied by Florian Martin on topic How to create a new custom Extrafield-Type?
Thanx for the answere.

I solved it with a dirty workaround like this to output just the value (from field id 55) without the generated input-field/HTML-Tag.

$LabelName = explode("<input type=\"text\" name=\"K2ExtraField_55\" id=\"K2ExtraField_55\" value=\"", $custom_field->LabelName->element);
$LabelName = explode("\"", $LabelName[1]);
$LabelName = $LabelName[0];

With this I could create a db-output for a custom dropdown (with the previous valueselected)

<option value="<?=$singleOrganisation[1]?>"<? if ($singleOrganisation[1] == $LabelName) { echo " selected=\"selected\""; } ?>><?=$singleOrganisation[1]?></option><? } ?>

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum