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

Is this possible? Drop-down custom field that is a folder directory listing?

Development and Programming

jnicol's avatar
jnicol
13 posts
17 years ago
jnicol's avatar jnicol

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…

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

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

       
jnicol's avatar
jnicol
13 posts
17 years ago
jnicol's avatar jnicol

Hi Jamie, thanks for the tip!

Good to know my concept is achievable.

Yes I can programme PHP.

I don’t know when exactly I will find time to build the extension, but I will definitely do it. If I get stuck (no doubt I will!) I’ll hit you up for some advice…

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

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

       

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.