0

I am new to drupal and I was adding a button for editing the data from database. but when I am adding edit button using add content type then this error message is showing to me.Please help me to guide how to add buttons and relate them to database.

2
  • 1
    Provide more information. What errors you getting and what you want to do? It is unclear for another person.
    – Rupesh
    Commented Aug 17, 2014 at 16:02
  • Notice: Undefined index: edit_hidden in button_field_field_widget_form() (line 295 of C:\wamp\www\drupal\sites\all\modules\button_field\button_field.module) error message is this
    – Mak
    Commented Aug 17, 2014 at 16:03

1 Answer 1

1

You actually need to add the edit button in a node. well, first you need to get the node ID, create template.php and add this function :

function YOUR-THEME_preprocess_node(&$variables)
{
    if (isset($variables['node'])) 
    {
         $variables['id'] = $variables['node']->nid;
    }
}

in this way the node id will be saved in the $id variable inside the node template file. if you want to use the default node.tpl.php copy this file from modules/system/node.tpl.php. now add this code where ever you want in the new copied node.tpl.php

<?php
    global $base_url;
?>
<a href="<?php print $base_url;?>/node/<?php print $id;?>/edit">Edit the Content! </a>

if you suggest any theme hook (theme the node page) no difference does it make, use the above code, the link always will be

"<?php print $base_url;?>/node/<?php print $id;?>/edit"

Good luck

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.