SmartDocs method template, how to check isAuthenticated

Not applicable

On the SmartDocs method page I want replace "Send this request" button with "Register User" button for anonymous users.

How I check this in SmartDocs.hbr ?

As sample:

 {{#if user.isAuthenticated}}
    <button id="send_request">Send this request<br/><span>using the values above</span>
    </button>
    <a href="javascript:void(0)" title="Reset to default request parameters and body content.">Reset</a>
    {{else}}
    <a type="button" href="https://community.apigee.com/user/register">Register to Test This API</a>
    {{/if}}
0 1 109
1 REPLY 1

@Yaroslav

Create a custom module that implements hook_node_view() with something like

if ($node->type == 'smart_method' && $view_mode == 'full' && user_is_logged_in()) {     
  drupal_add_js(array('myModule' => array('key' => 'value')), 'setting');
}

I'm not quite sure how to modify smartdocs.hbr properly to be able to use that new value. You may need to tinker with model.js. The new value will be available in Drupal.settings.myModule.key (or whatever you used above).