Needs work
Project:
Entityreference prepopulate [D7]
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 May 2012 at 13:06 UTC
Updated:
19 May 2022 at 11:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
amitaibuYes, docs are still very lacking. It means that if there's no value in the URL, we force a drupal_goto().
It's very harcoded, we might like to add a setting to tell to which page to drupal_goto()
Comment #2
joachim commentedWhere does drupal_goto() if there's no destination given? Just to the front page?
Comment #3
amitaibuentityreference_prepopulate_field_attach_form() :
Comment #4
joachim commentedRight, but http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_goto/7 doesn't say what happens if $path is empty.
Comment #5
amitaibuIndeed, it goes to the front page.
Comment #6
adrien.nethink commentedWell, it seems that drupal_goto() function uses a $_GETvariable named "destination" in order to establish the final destination url, if none is given as an argument.
FROM : http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_goto/7
So, to change the destination url, whenever you call you're edit/create node page, just add "destination=mypage/mynode" in the URL arguments to redirect you fallback.
Example:
Comment #7
liquidcms commentedwouldn't access denied be a good option for this?
Comment #8
liquidcms commentedand this patch adds Access Denied as a fallback option.
i also set msg as type error rather than notice which has been used with other options. i personally don't like the notice option for any of these fallbacks. possibly for error should be type error, maybe redirect as type warning; but even there error is likely a better fit.
sorry, this is a std diff formatted patch; not git (not changing status i guess this should be a new issue as not exactly what is being reported here)
Comment #9
liquidcms commentedhmm.. ignore patch above.. should have been simple but drupal (core bug) in what it does for drupal_access_denied() function.. will need a different method to create access denied.
Comment #10
liquidcms commentedok, this is better
one thing i noticed about this though which i think is more of an issue with OG access control than with entref-prepop fallback is that if the og_group_ref value that is passed is for a group that the user does not have create content access for; then prepop will not have the item in the og_group_ref field list and will therefore appear as if not being filled; this in turn looks the same as no value being passed - in which case my access denied is hit and the "Field Groups audience must be populated via URL" msg is presented; which is not completely correct and is confusing to the user (since a ref was populated via the url)
i don't exactly understand when the std og access control kicks in and determines the user doesn't have access to add content to this group; possibly it is done on form submit? which seems wrong in itself - possibly a tighter integration between OG and ER-prepop is required.
Comment #11
drasgardian commentedThe attached patch gives an access denied option and also allows the redirect path to be configured rather than only redirecting back to the homepage.
Comment #13
drasgardian commentedupdate to last patch to clean up if-thens to switch and remove incorrect #required attribute.
Comment #14
amitaibuThanks for the patch - maybe we should move it to own issue?
Also it will require a simpleTest to assert the functionality.
Comment #15
drasgardian commentedPatch updated to include simpletest.
Comment #16
akalata commented#15 operates as expected, but the drupal_set_message call should use one of the supported message types: status, warning, error (patch uses 'notice').
Comment #17
akalata commentedUpdating issue status and title to classify the morph into a feature request.
In addition to cleaning up the issue I noticed in #15, I've added two more settings that will allow the user to set the message type (status, warning, error, or no message) and to customize the message itself, if desired.
Comment #19
drasgardian commentedUpdated patch to check for existence of message_type
Comment #20
rwilson0429 commentedPatch in #19 works well and definitely improves 'redirect' fallback explanation and options. This is a nice addition to the module's usability and functionality.
Comment #21
aaronbaumanbumpity bump
Comment #24
aaronbaumanThere have been dev releases, but still this patch hasn't been included.
Anybody home?
re-rolled against latest dev.
Comment #26
aaronbaumanComment #27
delacosta456 commentedhi
Patch #26 apply correctly on D7 7.69+php7.1+panopoly distro.
However i would like to know if message field or redirect field accept token usage
Thanks
Comment #28
delacosta456 commentedComment #29
delacosta456 commentedhi
When using only the set form error, this doesn't prevent the node to be saved
thanks
Comment #30
anybodyConfirming RTBC of #26 and say thanks for tests and reroll!
Comment #31
anybodyThis needs a reroll, but can be set RTBC afterwards! Please provide an interdiff.
@AaronBauman would you do that? I'd be happy to commit this then.