This seems simple in my head but for the life of me I can't figure out how to do it. I want to create a menu link for my content manages that simply says "Add Entry" which takes them to a page which has a dropdown list box containing the custom content types they can add which they will then select and click a continue button. It will then go to the form to add that type of content, I just want to add one step between the add menu item and the add form. A page from where they can select which one to add from a dropdown list box. Is this possible?
If it matters I'm currently using an Omega theme which often changes the way to go about adding code, but if you can tell me the general process to make this happen I'm sure I can make it work.
Comments
If you send them to node/add
If you send them to node/add it will display a page with the content types they can add.
theme_node_add_list
You can override the output of the standard node/add page by using the theme_node_add_list( ) method in your template. You should be able to rework this with a dropdown list instead.
See http://api.drupal.org/api/drupal/modules%21node%21node.pages.inc/functio...
Thank You!
That wasn't so bad and worked like a charm. Thanks for the direction!
function THEME_node_add_list($variables) {
$content = $variables['content'];
$output = '';
if ($_POST) {
$nodetype = $_POST['nodetype'];
header("Location: " . $_SERVER['HTTP_SERVER'] . "/" . $_POST['nodetype'] . "");
}
if ($content) {
$output = '<form method="post">';
$output .= '<select name="nodetype" class="node-type-list">';
foreach ($content as $item) {
$output .= '<option value="' . $item['href'] . '">' . $item['title'] . '</option>';
}
$output .= '</select>';
$output .= '<input type="submit" value="Continue">';
$output .= '</form>';
} else {
$output = '<p>' . t('You have not created any content types yet. Go to the <a href="@create-content">content type creation page</a> to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '</p>';
}
return $output;
}
I would have use
I would have use drupal_goto() to handle the redirect.
Will Do!
I'm still a drupal newb, but I will indeed switch it to drupal_goto(). Thanks for the information.
Seriously Omega!
Ok, so this worked under the standard theme, however when I tried the exact same thing on my site with the omega theme/template it ignores it. Apparently Omega does this differently. Does anyone have an ideas as to what the hook name in Omega would be or how I can do this under an Omega theme?
Nevermind!
I had some configuration options different between dev and production. On production I had the checkbox for use administrative theme when adding new content and so it was not using my default theme to add new content. Unticked the box and tada! Thank you everyone for your help!