I have a particular functionality in mind for a custom field. I haven’t developed an extension before, but it seems to me that an extension should be able to accomplish what I want. So I wanted to run it by some experts first to see if my idea is sound - or if someone has done it already!
So here is what I want to create:
A new custom field type, similar to the existing drop-down list field type, except that it is populated from a directory listing of file names.
Some further detail:
Imagine you have a folder on your server called ‘video’. By pointing the custom field at this folder, the end result in the ‘edit’/’publish’ area will be a list of all the files in that folder, of which the user can select one.
Does that make sense?
Hopefully someone can tell me if that is ‘do-able’, and a logical way to achieve the functionality I want…
Makes perfect sense jnicol.
I think I would look at the publish_form_field_unique to start out.
This will let you examine the custom fields and change them before the Publish panel displays them. It would be at that point that you would change your specified field to display a select box with the items fond in your specified directory.
Then you could have extension settings that allow a user to choose the fields they want affected by your extensions and the directory that should be looked at.
I’m going pretty high level here but hopefully you are getting the idea. I’m assuming you have some PHP coding skills since you are interested in jumping into this. I’d love to see the result and would be happy to help out if you need it.
Jamie
No Problem jnicol. I was actually just looking at the hooks a little closer and realized that while what I told you would work, you would actually want to create a new field type using the publish_admin_edit_field_type_pulldown hook first. Then the user would select the “directory” field type or whatever. And then the previous hook I already mentioned would deal with that field type as mentioned.
You can actually go even further with your integration if you wish as there are a whole set of publish_admin_edit_field* hooks that let you allow users to enter custom settings for a field as well.
Jamie
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.