You are here

function scald_atom_user_build_actions_links in Scald: Media Management made easy 7

Builds an array of action links for a given atom.

3 calls to scald_atom_user_build_actions_links()
scald_prerender in ./scald.module
Prepare a Scald Atom for rendering.
scald_views_handler_field_actions::render in includes/scald_views_handler_field_actions.inc
Renders the atom according in the context specified in the option form.
theme_sdl_library_item in modules/library/scald_dnd_library/scald_dnd_library.module
Returns HTML for an atom rendered in the "Library Item" context.

File

./scald.module, line 2686
The Scald Core, which handles all Scald Registries and dispatch.

Code

function scald_atom_user_build_actions_links($atom, $query = NULL) {
  $actions = scald_actions();
  $supported_actions = array(
    'view',
    'edit',
    'delete',
  );
  $links = array();
  foreach ($supported_actions as $action) {
    if (scald_action_permitted($atom, $action)) {
      $links[$action] = array(
        'title' => $actions[$action]['title'],
        'href' => 'atom/' . $atom->sid . ($action == 'view' ? '' : "/{$action}"),
      );

      // The 'edit' action supports CTools Modal.
      if ($action == 'edit' || $action == 'delete') {
        $links[$action]['attributes'] = array(
          'class' => array(
            'ctools-use-modal',
            'ctools-modal-custom-style',
          ),
        );
        $links[$action]['href'] .= '/nojs';
      }
      if ($query) {
        $links[$action]['query'] = $query;
      }
    }
  }
  drupal_alter('scald_atom_user_build_actions_links', $links, $atom);
  return $links;
}