Would you guys be interested in combining some of the functionality from http://drupal.org/sandbox/brantwynn/1376658 ?

In the "Relevant Content" Bean Tax plugin the articles are sorted by the number of matched terms between the currently displayed node and the matching relevant content.

IE: Node 1 shares 6 terms with Node 2, Node 1 shares 7 terms with Node 3.
So a "Relevant Content by term reference" would show Node 3 then Node 2 in the bean.

Feel free to lift code or I can co-contribute on this if you guys are down for that.

Comments

seanberto’s picture

Definitely interested in adding this functionality. Would you be open to submitting us a patch?

First, could we talk through configuration workflow? Right now, our sort options are set before choosing whether or not you are filtering on taxonomy. Consequently, we can't just add "taxonomy sort" to the sort options list - since it might not be applicable. I guess we'd need to add a second sort option - or perhaps a checkbox that appears in the taxonomy settings area (sorta like how we're setting the "sticky" sort option).

What do you think?

brantwynn’s picture

Here are some notes on configuration workflow along with accompanying screenshots. (Apologies for any weird code formatting, I am c/ping directly from the bean_tax.relevant.inc)

Display Options
5818994-node-display.jpg
I don't understand why you'd want to regress to D6 style tactics and limit the user to only showing their node results as full/teaser/link.

View modes are easy to use and instantiate, so it would be best to show all the view modes for the given bundle here.

Get currently available view modes for node bundle.

<?php
   
// Select objects for the node view modes that will be used.
   
$node_view_modes = array();
   
$entity_info = entity_get_info();
    foreach (
$entity_info['node']['view modes'] as $key => $value) {
     
$node_view_modes[$key] = $value['label'];
    }  

   
// Default view mode if no 'node_view_mode' is set.
   
if (!isset($bean->settings['node_view_mode'])) {
     
$default_node_view_mode = 'full';
    }  
    else {
     
$default_node_view_mode = $bean->settings['node_view_mode'];
    }  

   
// User select which view mode to use for the node results inside the bean.
   
$form['settings']['node_view_mode'] = array(
     
'#type' => 'select',
     
'#title' => t('Node View Mode'),
     
'#options' => $node_view_modes,
     
'#default_value' => $default_node_view_mode,
     
'#required' => TRUE,
     
'#multiple' => FALSE,
    );
?>

Later instantiate the result using the selected view mode.

<?php
$content
['nodes'][$node->nid] = node_view($node, $bean->settings['node_view_mode']);
?>

5818994-filter-on-taxonomy.jpg

I think the second screenshot here is fairly self-explanatory - just my idea for how this could work.

1. The user chooses a Sort "Order by Taxonomy term relation" and the results are shown as relevant by shared taxonomy terms either ascending or descending. The original "Order by" select box is disabled and a new option "controlled by taxonomy" or something similar is now selected.

2. Just a note: I find the interface/nested fieldsets under "Filter by taxonomy terms contextually?" to be confusing. The wording itself seems ambiguous. It should at least have a description for what this is really doing.

---

One last note that does not call for screenshots: What is the motivation to use "Yes/No" select items accompanied with a Question over checkboxes?

brantwynn’s picture

StatusFileSize
new75.59 KB
new33.99 KB

Forgot I cannot hotlink Skitch directly via D.O. :)

brantwynn’s picture

Status:Active» Needs review
StatusFileSize
new2.32 KB

Here is a patch that allows for the use of view modes. Right now it is defaulting to "Full".

It could be argued that the module should create a "Title" view mode and run and update hook to adjust said view mode for showing just node titles as a links.

Then again, users could just as easily create and edit this view mode themselves by using http://drupal.org/project/entity_view_mode

Moved the "View Modes" feature request to its own discussion for issue clarity: http://drupal.org/node/1513616

seanberto’s picture

Thanks for splitting these two issues out. FWI, our team is just getting off of two weeks of conferences and we have a bit of a backlog. It will probably be late next week before we can address this ticket. Please let us know if that's a major blocker for you @brantwynn. We really appreciate your collaboration on this module.

seanberto’s picture

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

FYI - See: #1552286: Extend "Sort" options. For the client who's paying for the development of this module, more granular options for sorting on date fields is required. So, we're going to prioritize that issue before looking at sorting based upon taxonomy weights.

brantwynn’s picture

Status:Needs review» Closed (won't fix)

People who need said functionality from a Bean can use the Taxonomy Related Bean Plugin via http://drupal.org/project/bean_tax