Home › Forums › Calendar Products › Events Calendar PRO › How to add additional "Field Type"?
- This topic has 10 replies, 3 voices, and was last updated 13 years, 3 months ago by
Barry.
-
AuthorPosts
-
December 17, 2012 at 5:38 pm #29660
Rebecca
ParticipantHi,
I have created and use four Additional Fields – 3 Text and 1 check box.
However, I want to make one of the Text into more like “Textarea”, so user can type in more than one line of texts.Also if possible, I want to make so that some basic html tag are usable in this Textarea, e.g. , etc, etc.
I have been looking at Tribe Settings API and looks possible to add additional field type, specifically textarea, but not sure. I was wondering if you could help.
https://theeventscalendar.com/tribe-settings-api/Thank you!
December 18, 2012 at 8:04 am #29686Barry
MemberHi Toru – so you would really just need to include an appropriate definition in the arguments you pass in when creating your settings tab:
December 19, 2012 at 2:25 am #29758Rebecca
ParticipantBarry,
Thanks for quick reply!
I don’t want to create a new tab – I would like to add “Textarea” to the dropdown list under “Filed Type” of Additional Fields tab.
Thanks.December 19, 2012 at 12:25 pm #29787Barry
MemberI see: sorry for the misunderstanding. Unfortunately I can’t help there, the field types are hard-coded in place and unless I’m mistaken there is no straightforward way to change that by normal means such as filtering or overriding.
That leaves an alternative of modifying core plugin code – however you’d really need to steam ahead and make that sort of change on your own, it’s not an approach we generally recommend or endorse.
I’m afraid there’s not a lot else I can offer up at this point.
December 19, 2012 at 12:27 pm #29788Barry
MemberActually, I didn’t look far enough. You could do this by working with the tribe_settings_after_content_tab_additional-fields hook and making some changes so that your own code replaces Tribe’s.
You would however need to find your own way in terms of building your customization.
January 16, 2013 at 10:49 am #30972Ben
ParticipantA couple of points. First, one of the main reasons I bought ECP was to add a textarea – so this is pretty disappointing. Second, the display of a textarea field is already defined in admin-views/event-meta.php, so all that is required to make this work is to add the option into the select field in admin-views/event-meta-options.php (around line 40), like so:
<option value="textarea" >Yes, only one line of code is required to add this functionality. What is added if you do this, however, is a pretty lame little textarea. Still, it’s better than a text input if you need more space.
Finally, the hook mentioned by Barry above is pretty much useless because if you add it into your theme or plugin, it doesn’t override the standard hook function, so the original hook function and the custom one are both called separately. This creates problems I won’t go into here, but is unfortunately not a viable approach, as far as I can tell.
January 16, 2013 at 10:51 am #30973Ben
ParticipantThat is:
<option value="textarea" >January 16, 2013 at 10:53 am #30974Ben
ParticipantWell, it won’t let me post the code or edit my previous comments, but if you look in event-meta-options.php you should see what I mean. If a moderator would like to delete my previous comment, feel free.
January 16, 2013 at 10:59 am #30975Barry
MemberHi Ben, thanks for the feedback 🙂
Finally, the hook mentioned by Barry above is pretty much useless because if you add it into your theme or plugin, it doesn’t override the standard hook function
You don’t need to leave the action set up by Events Calendar PRO in place, you can remove it and use your own action instead, so it is very much possible to do an override.
January 19, 2013 at 9:42 am #31180Ben
ParticipantThanks for your reply, Barry. You’re right, I spoke too soon. I’m still figuring out WordPress’s hook system, but I see now that you need to call remove_action() to remove the standard ECP function. I do look forward to having textarea as a standard field option, however, it’s not difficult to add as it stands.
January 21, 2013 at 3:57 pm #31324Barry
MemberNo it’s not ideal and we do appreciate this sort of feedback – I’ll double check to ensure we’ve got an issue logged for this so the devs can look at making this sort of thing easier in a future release.
-
AuthorPosts
- The topic ‘How to add additional "Field Type"?’ is closed to new replies.
