You are here

function scald_atom_add in Scald: Media Management made easy 7

Creates the page listing possible Scald Atom Types.

1 string reference to 'scald_atom_add'
scald_menu in ./scald.module
Implements hook_menu().

File

includes/scald.pages.inc, line 13
This file contains the various callbacks related to Scald defined pages.

Code

function scald_atom_add() {
  $types = scald_types();
  if (empty($types)) {
    return '<p>' . t('You have not installed any Scald providers yet. Go to the <a href="@admin-modules">modules administration page</a> to install a Scald provider.', array(
      '@admin-modules' => url('admin/modules', array(
        'fragment' => 'edit-modules-scald',
      )),
    )) . '</p>';
  }
  $content = array();
  foreach ($types as $name => $type) {

    // Skip atom type the user isn't allowed to create.
    if (!scald_action_permitted(new ScaldAtom($name), 'create')) {
      continue;
    }
    $content[] = array(
      'title' => scald_type_property_translate($type),
      'href' => 'atom/add/' . $name,
      'localized_options' => array(),
      'description' => '',
      'page_arguments' => serialize(array(
        $name,
      )),
    );
  }
  return theme('node_add_list', array(
    'content' => $content,
  ));
}