I hope this is the right place to ask such question.

When I create a "content pane" view, in the settings I get the options "Argument Input", that is very useful when I put such content pane on a Panel.

Right now I'm trying to build a add/edit form for a content type that has an "Entity Reference" field. The "Entity Reference" module gives the option to list referable entities using a view. The problem is that such view must be of the "Entity Reference" type, which has no "Argument Input" option.

I'm no coder, so I'm just guessing here, but, would it be possible to make the "Argument Input" option visible for the "Entity Reference" view? Would it then work?

Comments

merlinofchaos’s picture

Status: Active » Fixed

That would be up to the entityreference module, which controls all of the settings for its display type. There's no way for CTools to modify the settings on another display type. That is, in fact, precisely why CTools defines a specialized display type for use with Panels.

Such things are pretty complicated, though. There might already be questions about doing this in the entityreference module.

keyiyek’s picture

Thanks for the prompt reply.

I understand that the changes would have to be made in the "Entityreference" module. I was wondering if it would be possible to leverage the functionality of CTools to do such thing.

I imagine, maybe wrongly, that the "Argument Input" option is displayed on the "Content Pane" display because in its array definition there is an item like [argument_input], and then in some other part of CTools there is the code that makes it work.
If a module is put together with something like a "entityreference-somekindofhook_alter" adding such item to the "Entity Reference" display, what would happen?
Would it work? Nothing? Site explosion?

merlinofchaos’s picture

There isn't really a way to alter stuff like that, unfortunately.

It *might* be possible to subclass the entity reference display handler and create a new display handler with your functionality, but that will only be true if entityreference uses a flag to mark acceptable displays rather than specifically testing for its flag.

Once you do that, you could then alter the option_definition() and settings_form() methods on the handler and add in the argument input, and then modify the execute_display() method to actually utilize the input.

keyiyek’s picture

I tried to follow your instructions.

I don't know how to check if the flag you talk about exists, so I went down the road of hacking the entityreference module itself, and change its display, just to see if the rest is possible.
I found the option_definition() method in the entityreference_plugin_display.inc file and I added the line
$options['argument_input'] = array('default' => array());

but then, I could not find in the whole module the execute_display() method, and the only settings_form() method I found is in the entityreference.module file, and I'm not sure is the one I should modify.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.