DrupalGap
DrupalGap copied to clipboard
Adding markup below the Node content
I just need to add a link under the content of the node. I'm using hook_node_page_view_alter_TYPE().
How can I make a standard node render inside this hook? In the manual I found only custom rendering, but I need to leave all the markup, language settings, etc.
Or maybe there is a better way to solve my problem?
@SegaWeb There are a few more hooks you can try listed here:
https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/api/api.js
Try some of the hook_entity_*
ones, this one looks promising: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/api/api.js#L311
Yes, that would be better. But, build['foo'] does not display anything. Console.log works as expected.
function s_module_entity_view_alter(entity_type, entity_id, mode, build) {
try {
if (entity_type == 'node' && mode == 'view' && build.node.type == 'site') {
build['foo'] = { markup: '<p>Extra stuff when viewing own user profile...</p>' };
console.log(entity_type);
console.log(entity_id);
console.log(mode);
console.log(build);
}
}
catch (error) { console.log('hook_entity_view_alter - ' + error); }
}
Am I doing something wrong? Or the hook does not work?
Does anyone use hook_entity_view_alter, only it does not work for me? I really need to know