0
votes

Im a TOTAL newbie to drupal development so please help me here, ok i have created a custom module which so far creates a custom database how do i go about creating a list page in the backend that i can use to manage each item in the DB and how do i go about creating a custom edit form to manage the insert/ edit / delete of each item

function rollover_res_schema() {
$rollover_res = array();

$rollover_res['rollover_res'] = array(

// Example (partial) specification for table "node".
'description' => 'Positioning for rollovers',
'fields' => array(
  'rollover_res_id' => array(
    'description' => 'The primary identifier for a node.',
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ),
  'rollover_res_actual' => array(
    'description' => 'The main rollover plain text.',
    'type' => 'text',
    'length' => 255,
    'not null' => TRUE,
  ),
),
'indexes' => array(
  'rollover_res_id' => array('rollover_res_id'),
),  
'primary key' => array('rollover_res_id'),
);
   return $rollover_res;
 }
2

2 Answers

0
votes

If you're a total newbie to Drupal development you should not be writing ANY code for the first month or two and you shouldn't do custom database code the first 6 months.

Start with learning about Fields and Views and once you grasp these you can add one of Display Suite, Context or Panels.

0
votes

The key to learning how to do things in drupal is:

1) google search how 2) see how other modules do it. In this case, look at some core modules, such as the block module. In there you'll see the schema in .install, and you'll see some functions that create forms for saving new blocks, such as block_add_block_form. You'll need to read up on the form API. But basically, you'll create a form hook to display a form, a menu hook to create a page to hold the form, and a hook to submit the form. If you grep through your code base, you'll see many of examples that you can copy. In fact, there are drupal example modules you can download that cover most of the basics: https://www.drupal.org/project/examples

But to learn how to interact with the database, you could find a module that does something similar to what you're doing and look at how it uses hook_menu to set up page callbacks, forms for editing data.