Closed (outdated)
Project:
Redirect
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Jan 2015 at 10:45 UTC
Updated:
20 May 2025 at 21:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bgilhome commentedHere's a patch for review. It adds the option to select entity types to ENABLE redirect editing on, perhaps it would be less disruptive to change to disable?
NB this acts on redirect_field_attach_form() only, the 'redirect' on entity info is unaltered, so redirects can be enabled but the editing interface simply hidden.
Comment #2
bgilhome commentedComment #3
joelstein commentedGreat patch!
However, I don't think you've got the right defaults. Existing installations may be using this for all sorts of entity types.
Also, there's already a function which tells us whether or not an entity type supports redirect:
redirect_entity_type_supports_redirects(). We should leverage this somehow.Perhaps it could be worded differently, "exclude" instead of "include". So the form would show all entity types, exclude by default the ones excluded in redirect_entity_type_supports_redirects(), and save the value to a variable like "redirect_disable_entity_types". Then in redirect_entity_type_supports_redirects() we'd check the value of this variable in addition to the other methods?
Comment #4
anybody+1 for the idea! We need an interface like the metatags modul to select the entities the module is active on!
Perhaps have a look at the latest version there?
Comment #5
aaronbaumanAgree with #3: previous patch drastically changes existing behavior, which is against Drupal best practices.
Attached is a simple re-rolled patch which is essentially the inverse:
the form disables Redirects on specific entities, but defaults to "on"
Comment #6
jrreid commentedWorks perfectly for me, but I agree that we should probably try to utilize redirect_entity_type_supports_redirects() as this is pretty similar to what its used for. New patch attached.
Comment #7
devad commentedThis is requested long ago and redirected here: #1604068: Limit redirects by entity / bundle.
Is it complicated to implement per-bundle choice as well?
Comment #8
scronide commentedTried patch #6. It didn't apply cleanly for me but manually making the changes seemed to work. One problem with the patch is that your selection is excluded from the list of entities: so you can't add to your current selection, you can only replace it.
Comment #9
Echofive commentedHello,
The patch #6 is not correct (see comment #8).
So I've create a new patch based on the patch made by jrreid.
The issue in his patch is the fact that the function (redirect_entity_type_supports_redirects) used to define the checkboxes options also skip the disabled options.
I've add a new patch, tested on the branch 7.x-1.0-rc3 and the 7.x-1.0-dev.
Kind regards,
Echofive
EDIT: PATCH ...-9.patch is not correct, use the ...-10.patch
Comment #10
Echofive commentedSorry, big logical error into my previous patch (see comment #9), but the concept is the same.
I've added the right version ;)
Comment #11
chris matthews commentedThe patch in #10 from 2 years ago still applied cleanly to the latest 7.x-1.x-dev and would indeed be a great addition to both the 7.x-1.x and 7.x-2.x branches of the module.
Comment #12
damienmckennaI simplified the logic and made it still backwards compatible.
Comment #13
damienmckennaI wonder if this could be handled through hook_entity_info_alter() by setting the $info[$unsupported_entity_type]['redirect'] = FALSE; just like the module does with some entity types already?
Comment #14
damienmckennaThis is an improved version that fixes the changes made to the settings page.
Comment #15
anybodyGreat @DamienMcKenna! Just reviewed the patch manually and tried it, does what it should and the logic looks correct to me.
Comment #16
sgdev commentedHave been using this patch since #10. Added #14 to the latest 7.x-1.0-rc4 release and working just as well. Marking as reviewed.
Comment #17
kristen polAssigning to myself as I'm triaging all RTBC issues.
Comment #18
kristen polThanks, everyone, for the issue, patches, testing, and reviews. I scanned the code and didn't see anything obviously amiss.
This is a nice little feature, but one thing it's missing is some tests for testing the new functionality. I know it's not a bug, but IMO it still needs tests, so marking for that.
Comment #19
wylbur commentedClosing this as Outdated as Drupal 7 is EOL.