You are here

function _disqus_ds_comment in Disqus 7

Display the DS comments for a node

1 string reference to '_disqus_ds_comment'
disqus_ds_ds_fields_info in disqus_ds/disqus_ds.module
Implementation of hook_ds_fields_info().

File

disqus_ds/disqus_ds.module, line 33
Drupal module that adds Disqus support to Display Suite.

Code

function _disqus_ds_comment(array &$field) {
  $entity = $field['entity'];
  if (isset($entity->disqus) && $entity->disqus['status']) {
    $settings = array(
      'disqusComments' => $entity->disqus['domain'],
      'disqus' => $entity->disqus,
    );
    $render = array(
      '#type' => 'disqus',
      '#disqus' => $entity->disqus,
      '#access' => user_access('view disqus comments'),
      '#attached' => array(
        'js' => array(
          array(
            'data' => drupal_get_path('module', 'disqus') . '/js/disqus.js',
            'type' => 'file',
          ),
          array(
            'data' => $settings,
            'type' => 'setting',
          ),
        ),
      ),
    );
    return drupal_render($render);
  }
  return;
}