You are here

function onlyone_node_add_list in Allow a content type only once (Only One) 7

Returns HTML for a list of available node types for node creation.

Parameters

array $variables: An associative array containing:

  • content: An array of content types.
1 string reference to 'onlyone_node_add_list'
onlyone_theme_registry_alter in ./onlyone.module
Implements hook_theme_registry_alter().

File

./onlyone.pages.inc, line 50
Page callbacks for adding content.

Code

function onlyone_node_add_list(array $variables) {
  $content = $variables['content'];
  $output = '';
  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
      $output .= '<dd>' . filter_xss_admin($item['description']) . '</dd>';
    }
    $output .= '</dl>';
  }
  else {
    $output = '<p>' . $variables['message'] . '</p>';
  }
  return $output;
}