0

There is any way to add a button into the content type for example Article as show in the below figure

enter image description here

there is any module for adding the button within the content type in drupal 7.

1
  • Have you completed this task?
    – Cindrella
    Commented Sep 21, 2012 at 6:36

1 Answer 1

1

The page in your screen shot is a 'node add' page for a particular content type in your drupal site. Therefore the best way to add more elements there is to utilize hook_form_alter()

<?php
function custom_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'mynodetype_node_form') {
    dsm($form); // This function is available via Devel module. Here, it shows you the contents of $form in a structured manner, so that you know where to make the change to add a button.
    // Add code here to add button in the form etc.
  }
}
?>

The above code snippet assumes your module name is custom and your content type name is mynodetype

To understand what code you need to write to add new form element (in your case a button), refer drupal form api - http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7

3
  • How to see the devel output.Here my node type name is External News.So I replaced the mynodetype_node_form with External News_node_form
    – bharathi
    Commented Mar 14, 2012 at 10:19
  • 1. Any node type has a human name and a machine name. The machine name never has a space. You need to use machine name in the function. Commented Mar 14, 2012 at 10:52
  • 2. Devel module provides this function called dsm() that takes in any array or an object and shows that on the site in a easy to explore way. The output is visible in the "message area" of the site. Commented Mar 14, 2012 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.