Download & Extend

Underscore dash conflict on link to create new content.

Project:Rules
Version:7.x-2.x-dev
Component:Rules Engine
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)

Issue Summary

Hi,
I have created a simple rule to show message, after updating the content, to add a new node. It works fine in all cases except when the content type machine name has an underscore, e.g. if machine name is page_image then node add link is node/add/page-image and so my rule massage create a false link (because it creates a link site:url/node/add/page_image. How can I solve this problem. Here is the export of my rule:

{ "rules_add_more_contetent" : {
    "LABEL" : "Add More Contetent",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "message", "node" ],
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_presave" ],
    "IF" : [ { "entity_is_of_type" : { "entity" : [ "node" ], "type" : "node" } } ],
    "DO" : [
      { "drupal_message" : { "message" : "\u003ca href=\"[site:url]node\/add\/[node:type]\"\u003eClick here to add another [node:content-type].\u003c\/a\u003e" } }
    ]
  }
}

Thanks,
Perry.

Comments

#1

Project:Entity API» Rules
Version:7.x-1.0-rc1» 7.x-2.x-dev
Component:Entity tokens» Rules Engine
Category:task» support request

Nothing entity api or rules can do about it, that is how core works.

#2

Here's my temporary solution:

// JavaScript Document
(function ($) {
$(document).ready(function() {
var x =  $('.add-message').attr("href");
var y = x.replace("_", "-");
$('.add-message').attr("href", y);
});
})(jQuery);

Perry.

#3

Category:support request» bug report
Status:active» postponed (maintainer needs more info)

Does this issue need to be moved to core or included as a work-around in Rules?