Jump to content

Combining two core Inputfield modules in one


Recommended Posts

Hi everyone,

I am fairly new to ProcessWire and am trying to get the hang of creating custom InputFields. Specifically, I am trying to combine two of the core inputfield modules into one custom inputfield. Something that looks like this:

Screen_Shot_2016_06_07_at_3_13_41_PM.png

The purpose of this InputField:

- Used in the Admin area, in the Edit area of a particular page

- In the search, I query for a particular item that exists in PW

- In the results, I can press an add button besides an item that I am interested

- The items that I added is put on the top (the green area), where I can delete them later if I wish

- I can search for new items, get new results, but the green area with the items that I'm interested in previous searches do not go away (unless I navigate away from the page).

So a couple of questions about this:

- Is the top element (the green part) called InputFieldAsnSelect and the bottom part (the search AND the search results) called InputFieldSelector?

- What is a good way to approach this? I'm kind of at a loss on what to do.

    - Do I create a module that extends both InputFieldAsnSelect and InputFieldSelector and try to get them to interact with each other? If so, how? Will this be mostly in JS or in the PHP module? If not, how should I approach this and what should I educate myself on to make this possible?

- My InputField is meant to be able to search all the templates and fields. Would this be possible?

If I get any of the terminology wrong or if a glaring mistake in my understanding of PW is spotted, by all means please point it out.

Thank you!

Link to comment
Share on other sites

About the Inputfield names you're mostly correct, but it's ASM not Asn :)

As php doesn't even allow you to extend of of multiple classes you would rather use those module's to render themselves as part of your module. The piece you'll need to add to allow both Inputfields to interact would be mostly JS work, but I'd say you need a good PHP understanding as well as InputfieldSelector is one of the most complex Inputfields we have in pw.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...