You are here

function references_dialog_build_element in References dialog 7

1 string reference to 'references_dialog_build_element'
references_dialog_element_info in ./references_dialog.module
Implements hook_element_info().

File

./references_dialog.module, line 427
This the main module file.

Code

function references_dialog_build_element($element) {
  $dialog_links = array();
  $element['#attached']['js'][] = references_dialog_js_settings($element['#id'], array(
    'format' => $element['#format'],
    'target' => $element['#target'],
  ));
  if (isset($element['#operations'])) {
    foreach ($element['#operations'] as $operation => $link) {
      $link['attributes']['class'][] = $operation . '-dialog';
      $dialog_links[] = references_dialog_link($link);
    }
  }
  if (isset($element['#attachable'])) {
    $dialog_links = array_merge($dialog_links, references_dialog_get_views_search_links($element['#attachable']));
  }
  if (count($dialog_links)) {

    // We add a div directly into the markup here since we really need it in order
    // to make sure the javascript works.
    $element['#suffix'] = reference_dialog_links_themed($element['#id'], $dialog_links);
  }
  return $element;
}