Popups Intergration
kryptik - October 29, 2008 - 03:02
| Project: | Nodereferrer Create |
| Version: | 6.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm creating this as a feature request
This allows integration with the popups module, I have not done the necessary changes, to make it a dependency, plus I haven't included a proper patch, so I won't mark this as fixed, until those are taken care of.
Anyways, this WILL WORK, if you have the popups module installed.
find:
function _nodereferrer_create_nodeapi_view_referrer(&$node, $teaser, $page) {
now replace:
$menu_items = array();
foreach($node->referrers as $i => $ref) {
$items = array();
foreach ($ref['referrence'] as $type => $nf) {
$type_info = content_types($type);
if (count($nf) == 1) {
$text = t(variable_get('nodereferrer_create_label', 'Create new @type'),
array('@type' => $type_info['name']));
$url = 'node/'.$node->nid.'/create_referrer/'.$i.'/'.$type.'/0';
$items[] = l($text, $url);
if ($nf[0]['multiple'] == 1) {
$text = t(variable_get('nodereferrer_create_add_label', 'Add to existing @type'),
array('@type' => $type_info['name']));
$url = 'node/'.$node->nid.'/add_referrer/'.$i.'/'.$type.'/0';
$items[] = l($text, $url);
}With:
$menu_items = array();
foreach($node->referrers as $i => $ref) {
$items = array();
popups_add_popups();
foreach ($ref['referrence'] as $type => $nf) {
$type_info = content_types($type);
if (count($nf) == 1) {
$text = t(variable_get('nodereferrer_create_label', 'Create new @type'),
array('@type' => $type_info['name']));
$url = 'node/'.$node->nid.'/create_referrer/'.$i.'/'.$type.'/0';
$options = array (
'attributes'=>array('class'=>'popups'),
);
$items[] = l($text, $url, $options);
if ($nf[0]['multiple'] == 1) {
$text = t(variable_get('nodereferrer_create_add_label', 'Add to existing @type'),
array('@type' => $type_info['name']));
$url = 'node/'.$node->nid.'/add_referrer/'.$i.'/'.$type.'/0';
$items[] = l($text, $url, $options);
}Now when you click create or add existing it will load in a modal window, and you can add related content without leaving the original node.
let me know if this works for ya.

#1
Sorry, just so you know this is in the .module file of nodereferrer
#2
Hi, does this degrade nicely?
#3
Hello, yes if javascript is not available then it functions as per normal.
Couple things I've noticed with pop-up intergration.
Image Upload doesn't work well (yet), when uploading a cck imagefield it will break out of the modal window after upload. The user can still complete the form, but it can be a little confusing.
It would be nice if this could be made an option in the admin. I'll look into exactly how that's done as I'm not a programmer. But it would be nice.
Another conflict to note is popups does not allow popup chaining (modals launched from modals). This can be a hinderance if you are trying to create a content type that uses popups: Add and reference.
What I've done to get around this is load "Create new content referrer" as per normal but with a query destination to return to original node. I then load the "add existing" to a pop-up.
This keeps the workflow smooth, and avoids any conflicts I've run into.