How to add additional "Field Type"?

Home Forums Calendar Products Events Calendar PRO How to add additional "Field Type"?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #29660
    Rebecca
    Participant

    Hi,

    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!

    #29686
    Barry
    Member

    Hi Toru – so you would really just need to include an appropriate definition in the arguments you pass in when creating your settings tab:

    http://pastebin.com/PdJCcGK3

    #29758
    Rebecca
    Participant

    Barry,
    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.

    #29787
    Barry
    Member

    I 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.

    #29788
    Barry
    Member

    Actually, 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.

    #30972
    Ben
    Participant

    A 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.

    #30973
    Ben
    Participant

    That is:
    <option value="textarea" >

    #30974
    Ben
    Participant

    Well, 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.

    #30975
    Barry
    Member

    Hi 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.

    #31180
    Ben
    Participant

    Thanks 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.

    #31324
    Barry
    Member

    No 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.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘How to add additional "Field Type"?’ is closed to new replies.