Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Ambroise A on
Hi,
I use the heartbeat module with rules, to display a message when a node is created. But when I create a node, I have this error message:
Notice : Undefined index: attachments dans views_handler_field_heartbeat_attachments->render() (line 22 in /Applications/MAMP/htdocs/biot/sites/all/modules/heartbeat/views/views_handler_field_heartbeat_attachments.inc).
How can I solve this?
Here is the code of the file: (Line 22 is: return $this->render_attachments($view['attachments']);)
<?php
/**
* Field handler to present message attachments for the activity.
*/
class views_handler_field_heartbeat_attachments extends views_handler_field {
function construct() {
parent::construct();
$this->additional_fields['uaid'] = 'uaid';
}
// function query() {
// $this->ensure_my_table();
// $this->add_additional_fields();
// }
function render($values) {
$uaid = $this->get_value($values, 'uaid');
$heartbeatActivity = heartbeat_activity_load($uaid);
if ($heartbeatActivity->template->hasPluginAttachments()) {
$view = heartbeat_activity_view($heartbeatActivity);
return $this->render_attachments($view['attachments']);
}
}
function render_attachments($attachments) {
return drupal_render($attachments);
}
}