We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Fieldtype creation help needed

Development and Programming

Airtype Studio's avatar
Airtype Studio
14 posts
15 years ago
Airtype Studio's avatar Airtype Studio

Hello,

I am trying to create a new type of fieldtype and need some help from someone who’s done it before.

I would like to create a select (dropdown) fieldtype. Easy enough, until the client wants to add a new item to the select list. Then they have to go to the Admin tab, choose custom fields, and add a new item. Again, not so hard, except that I don’t give my clients access to the Admin tab. This is common enough of an issue that I’m having a hard time believing this feature doesn’t already exist.

So what I need is a text input on the Publish page and a checkbox that says “create new” or something like that. If that box is checked, it will look to the text input and ignore the select element. It takes the text input’s value, saves it to the list for next time, and uses that value on the resulting page.

I’ve been tinkering with it for some time, but I’m just not a strong enough PHP or CI developer to sort it out by myself. Anyone got any insight? I’d sure appreciate it.

Marcus

       
denza's avatar
denza
13 posts
15 years ago
denza's avatar denza

I need the same and try to make it. I suppose the architecture will be as follows: 1. create custom field type (dropdown + input) for publish form 2. create extension and use “entry_submission_ready hook” for example 3. extension will get posted data and compare values of our field and field_list_items and if no match - insert the new one in field_list_items

       
denza's avatar
denza
13 posts
15 years ago
denza's avatar denza

Here we come! Needs testing. I’ve struggling with save revisions (I use it) - there’s no hooks for it, so I’ve made a little trick with save revision button…

here the link to addon

well, welcome feedback…

       
Airtype Studio's avatar
Airtype Studio
14 posts
15 years ago
Airtype Studio's avatar Airtype Studio

Hey,

Thanks for giving it a shot. Looks like some good work.

I’ve tested and it appears to have worked, though when I submit the Publish form I get PHP errors back. Again, it all appears to work, but I’m getting the exceptions. I’ve attached a screenshot.

       
denza's avatar
denza
13 posts
15 years ago
denza's avatar denza

try to replace this:

if ($data[revision_submit]){ // get back

to this:

if (isset($data['revision_submit'])){ // get back
       
Airtype Studio's avatar
Airtype Studio
14 posts
15 years ago
Airtype Studio's avatar Airtype Studio

Tried that and it got rid of the 2nd of the three notifications, but the other two still exist.

I’m trying to find where the revision_submit name attribute actually gets applied somewhere. Looking at the JS in your ft.cstslct.php file, I’m not seeing any element on the page with an ID of revision_button, so I’m not sure the revision_submit name is ever getting applied somewhere.

       
denza's avatar
denza
13 posts
15 years ago
denza's avatar denza

Element with ID of revision_button appears when you Enable Entry Versioning (CP Home-Administration-Channel Management-Channel Preferences) to save Revision of an Entry and get back to edit form (I always use revisions).

But this JS don’t affect to this error, even if there is no revision_button - It just ignore it.

Usually such a type of PHP error happens when I forget quotes, I think… I’ll try to catch this error

PS third error will disapear when get rid of first

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

Hey all, as per our Community Guidelines, we don’t allow distribution of third-party add-ons or related support on our forums. There are some great recommendations in that thread for where to host addons and offer support.

We do allow you to receive support for building those add-ons in these forums, though.

Thank you for understanding!

       
Adrian Macneil (Crescendo)'s avatar
Adrian Macneil (Crescendo)
28 posts
15 years ago
Adrian Macneil (Crescendo)'s avatar Adrian Macneil (Crescendo)

What a strange rule.. are you trying to discourage the community from building add-ons? Anyway it looks to me like the addon is actually hosted on devot-ee and they were simply providing a link to it..

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

Hi, Adrian,

You can read our blog post about this decision.

And the add-on was actually attached in the post, before I removed it, which is why I popped in here.

A link to Devot-ee would be perfect.

Thank you!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.