VBO vs entity_property_info_alter to provide a list

Events happening in the community are now at Drupal community events on www.drupal.org.
AldenC's picture

Thanks to the screencasts by Mr. Falk, I have written a simple custom module to provide a list for rules that has the node IDs of all the pages in a book. This is a global variable provided by the entity API and it works great. Currently I think the only "out of the box" list regarding books is the ancestor: lists and they don't contain branches or children.

My plan is to use this list to perform actions and conditions on books like providing page numbers, deleting, flagging, and (I may be dreaming here) compile all pages into a pdf file for printing.

As I continued viewing the screencasts on rules (what I call manna from heaven), I see that I can do the same thing with VBO.

Before I go much further in the entity_property directions, my questions are:

Are there performance issues in using the entity API method vs VBO that could cause problems with large books?

Is there another way to do this I don't know about?

Any input on the code below will be appreciated, (don't worry about hurting my feelings, I know I suck).

Thank you in advance!

function book_rules_entity_property_info_alter(&$info) {
$info['node']['properties']['book_rules_page_list'] = array(
'label' => t('Book page list'),
'description' => t('List of pages in a book by nid toc order'),
'type' => 'list',
'getter callback' => 'book_rules_make_page_list',
);
}

/* This function pulls the array (list) using book_toc which
* first only gives mlid and title of the nodes. The returned
* array has node ids keyed by mlid so common actions and
* conditions can be performed on the book nodes
*/
function book_rules_make_page_list($node) {
$page_list = array();
$current_bid = $node->book['bid'];
$toc_of_book = book_toc($current_bid, '9');
foreach($toc_of_book as $book_mlid => $book_title) {
//drupal_set_message('the book menu id is ' . $book_mlid);
$select = db_select('book', 'b')
->fields('b', array('nid'))
->condition('b.mlid', $book_mlid);
$toc_nid = $select->execute()->fetchField();
$page_list[$book_mlid] = $toc_nid;
}
return $page_list;
}

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: