Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding markup below the Node content #1023

Open
SegaWeb opened this issue Jun 27, 2018 · 3 comments
Open

Adding markup below the Node content #1023

SegaWeb opened this issue Jun 27, 2018 · 3 comments

Comments

@SegaWeb
Copy link

SegaWeb commented Jun 27, 2018

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 SegaWeb changed the title Adding markup below the site content Adding markup below the Node content Jun 27, 2018
@signalpoint
Copy link
Owner

@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

@SegaWeb
Copy link
Author

SegaWeb commented Jun 28, 2018

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?

@SegaWeb
Copy link
Author

SegaWeb commented Jul 4, 2018

Does anyone use hook_entity_view_alter, only it does not work for me? I really need to know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants