You are here

function scald_views_handler_field_actions::render in Scald: Media Management made easy 7

Renders the atom according in the context specified in the option form.

Overrides views_handler_field::render

File

includes/scald_views_handler_field_actions.inc, line 27
Provides a field containing the actions allowed for the current user on an atom

Class

scald_views_handler_field_actions
@file Provides a field containing the actions allowed for the current user on an atom

Code

function render($values) {
  $atom = scald_fetch($values->sid);
  if ($this->options['end_user_links']) {
    $links = scald_atom_user_build_actions_links($atom, drupal_get_destination());
  }
  else {
    $links = array();
    foreach (scald_actions() as $action) {
      if ($atom->actions & $action['bitmask']) {
        $links[] = array(
          'title' => $action['title'],
        );
      }
    }
  }
  $content = array(
    '#theme' => 'links',
    '#links' => $links,
    '#attributes' => array(
      'class' => array(
        'links',
        'inline',
      ),
    ),
  );
  return $content;
}