Open
Description
Hi,
First, p2p is absolutely awesome. It has saved me a tremendous amount of time on this particular website and I plan on using it often in the future as well. So thank you to the maintainers!
I've noticed that p2p_register_connection_type does some undesirable things when using an array for the to
end of the connection. The goal here is to let a particular connection type be available to numerous content types -- ideal for associating generic promotional bits of content to specialized content throughout the site. My example:
p2p_register_connection_type(array(
'name' => 'features_to_pages',
'from' => array('event', 'post'),
'from_query_vars' => array('tag' => 'feature'),
'to' => array('event', 'page', 'post'),
'title' => array(
'from' => __('Featured on'),
'to' => __('Features'),
),
'sortable' => 'to',
));
What happens is:
- The
from_query_vars
no longer limit thefrom
side of the query. In fact, thefrom
side of the query suddenly seems to accept pretty much anything. - Types which are specified only in
to
are suddenly eligible asfrom
for this connection type. For example, my Pages now have a "Featured on" box in the admin. They should not.
Am I registering the type wrong, or are these valid issues? Do I instead have to create explicit connection types for each target content type?