0

I have created a paragraph bundle with text fields that ask for social media accounts(facebook account name, youtube account name, twitter account name) Then a custom module will grab that account name and then return the latest feeds for that account.

I created a new template file for the paragraph bundle called paragraphs-item--custom_feed.tpl.php

From this template file I call the functions I created in my custom module but I realize that this works only if i'm signed in as an admin. If I view the page without being an admin then nothing appears where that bundle should be.

<div class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <div class="content"<?php print $content_attributes; ?>>
    <?php print my_module($content['field_youtube'][0]['#markup']); ?>    
  </div>
</div>

EDIT: while changing permissions allowed me to view the paragraph as anonymous and authenticated I was wondering if using hook_preprocess_entity would be a better way to do this so i can can pass the proper variables to the paragraph template file.

  • does your non-admin user have permissions to view this bundle? – longboardnode Jan 5 '18 at 20:29
  • While that worked i'm wondering if there anything using hook_preprocess to make this happen outside of the paragraph template bundle. – blu Jan 8 '18 at 18:13
  • "While that worked"... what do you mean? did adding permissions fix it? the hook_preprocess is a new question really... what would be the benefit of using the hook_preprocess over the template? – longboardnode Jan 8 '18 at 18:38
  • yep changed the question, all api queries would be done on the paragraph bundles template file. I thought that wasn't best practice. – blu Jan 8 '18 at 19:04
  • what API? there is no mention of any API in your question. – longboardnode Jan 9 '18 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.