function onlyone_help in Allow a content type only once (Only One) 7
Same name and namespace in other branches
- 8 onlyone.module \onlyone_help()
Implements hook_help().
File
- ./
onlyone.module, line 17 - Allows to define if a content type must have more than one node in the site.
Code
function onlyone_help($path, $arg) {
switch ($path) {
// Main module help.
case 'admin/help#onlyone':
// The route onlyone/add exists or not?
if (variable_get('onlyone_new_menu_entry')) {
// Creating the link.
$onlyone_add_page = t('<a href="@link">Add content (Only One)</a> page', array(
'@link' => url('onlyone/add'),
));
}
else {
// As the route doesn't exists we use a string.
$onlyone_add_page = t('<em>Add content (Only One)</em> page (onlyone/add)');
}
// Array with routes to replace.
$routes = array(
'@settings-page' => url('admin/config/content/onlyone/settings'),
'@content' => url('admin/content'),
'!onlyone_add_page' => $onlyone_add_page,
'@add-content' => url('node/add'),
);
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Allow a content type only once (Only One) module allows the creation of Only One content per language in the selected content types for this configuration.') . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Configuring content types') . '</dt>';
$output .= '<dd>' . t('To configure the content types to allow for Only One content per language, visit the <a href="@config-page">Only One</a> page, in the <em>Available content types for Only One</em> section and <em>check</em> the content types that should have Only One content per language. For this you need the <em>Administer Only One</em> permission.', array(
'@config-page' => url('admin/config/content/onlyone'),
)) . '</dd>';
$output .= '<dt>' . t('Configuring module settings') . '</dt>';
$output .= '<dd>' . t('To configure the module settings visit the <a href="@settings-page">Settings</a> page, if you want to have the configured content types in a new menu entry named <em>Add content (Only One)</em> you must check the option <em>Show configured content types in a new menu entry?</em>, the new menu link will be available in the <a href="@content">Content</a> page as an action link to the !onlyone_add_page, then the <a href="@add-content">Add content</a> page will show the not configured content types. For this you need the <em>Administer Only One</em> permission.', $routes) . '</dd>';
$output .= '<dt>' . t('Creating content') . '</dt>';
$output .= '<dd>' . t('Once you try to <a href="@add-content">Add content</a>, if the chosen content type is configured to have Only One content and it already has one content created in the actual language, you will be redirected to <em>edit</em> the content, otherwise, you will go to create a new onw.', array(
'@add-content' => url('node/add'),
)) . '</dd>';
$output .= '</dl>';
return $output;
}
}