according to documentation I should be able to use views to display rules_links but the links I create are not available in the views field drop down.

Comments

BenK’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev

I'm experiencing a similar problem. First, to make the links available in the Views config screen, you need to upgrade to the latest Views-7.x-3.x-dev release. Once I did that I could select my Rules Link as a field.

However, even after doing that, the actual link was not displaying in my View.

Ideas, anyone?

Thanks,
Ben

sepgil’s picture

Have you selected the right bundles? Are your visibility conditions correct?

itangalo’s picture

I get similar results, and after digging around in the code I think I know why.

In rules_link.views.inc, line 43, there is this condition for rendering the link:
if (in_array($entity->type, $rules_link->settings['bundles']))

This works well for nodes, but bad for eg. comments – since comments don't have the type property. One would like to have a generic $entity->bundle property, but I'm pretty sure Drupal doesn't provide that by default.

The solution for this is, probably, to load Entity API functionality and use that to check $entity->bundle. (Another approach would be to skip the separate bundle setting and use the visibility conditions instead – but that would decrease usability.)

Note: The field is listed when editing my views, but the actual output is not rendered.

sepgil’s picture

I think I've fixed by fixing other issues, can anyone try to reproduce this issue with the newest dev version?

oscarmatox’s picture

Not only did I reproduce with the dev version of Oct 21, but the link on the entity's page no longer shows.

Here's what I did, if you want to try and reproduce:

   - Installed a fresh Drupal 7.8 (plus French localization, if that matters)
   - Installed the following modules:
      - Localization Update (l10_update-7.x-1.0-beta2.tar)
      - CTools (ctools-7.x-1.0-rc1)
      - Entity (entity-7.x-1.0-beta10)
      - Rules (rules-7.x-2.0.tar)
      - Views (views-7.x-3.0-rc1)
      - Rules Link (rules_link-7.x-1.x-dev)
   - Activated the following
      - Under CTools, activer Chaos Tools
      - Under Multilingual : Localization Update
      - Under Other : Entity API, Entity Tokens
      - Under Rules : Rules, Rules Link, Rules UI
      - Under Views : Views, Views UI
   - Created a new Rule Link
      - Label : Test Rule Link
      - Link text : Run Test Rule Link
      - Entity Type : Node
      - Bundles : Article
      - Show link in entity : checked
      - Link type : Normal
      - Visibility conditions : left empty
      - Reactions : new rule
         - Name : Action for Test Rule Link
         - Condition : Content is of type Article
         - Action : Show message on the site "Hello world"
   - Granted access to all roles to this Rule Link
   - Created a new View
      - View name : Rule Link Test View
      - Display Content of type Article sorted by Title
      - Create a page
         - Display format : Array of fields
         - Create a menu link (Main menu)
      - Continue and edit :
         - Fields : Add => No field for Rule Link!

I then created a new Article. No link when displayed. On another Drupal sandbox with rules_link-7.x-1.x-beta2, I have the link.

Hope this helps, because this module clearly fills a need!

Bruno.

pradbone’s picture

Upgrading to the latest version of views Dec resolved this issue for me.

sepgil’s picture

Status: Active » Fixed

The might have caused the problems...
So please update to the newest views dev version and the problems should be fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Yuri’s picture

Issue summary: View changes

Im using the latest 7.x-2.x-dev (8 dec 2016) and encountered the same issue.
However, I found out that this was caused by one of the rules links rules to have an incorrect configuration.
This causes all other rules links, also the good ones, not to show up in views.

Yuri’s picture

Status: Closed (fixed) » Needs review
nwom’s picture

Status: Needs review » Active

The Needs Review status is for reviewing attached patches. I assume that you wanted to set the status to Active in this case.