I created a custom VBO action to change a value in the selected item. I have the button displayed as "hide item". When I activate it on the item it doesn't seem to fire and change the value at all. I did a test to change the name to xxxxx and visible to 0, but it doesn't look like its working. Maybe my code is wrong?
It does seem like its working as I output the result in the set_message function (in green box in screenshot). 1 indicates that 1 row has been affected, but i still see the item on my View and the name hasn't even changed.
Maybe something is off here?
Module Code:
function office_action_info() {
return array(
'action_off' => array(
'type' => 'entity',
'label' => t('Hide Item'),
'configurable' => FALSE,
'behavior' => array('changes_property'),
'triggers' => array('any'),
),
);
}
function action_off($entity, $context = array()) {
$blah = db_update('office')
->fields(array(
'verified' => 0,
'name' => 'xxxxxxx',
))
->condition('office_id', $entity->office_id, '=')
->execute();
drupal_set_message($blah .'====='. $entity->name .'===='. $entity->office_id);
}
office
entity, perhaps it will have same problems with caching asnode
? Have you triedentity_get_controller('office')->resetCache(array($entity->office_id));
action_off
function. Simplyentity_load
then modify the values and then doentity_save
.