India

ZestyBeanz Technologies Pvt Ltd 4th Floor, Nila, Technopark Thiruvananthapuram,
India – 695581
Phone: +91 471 4063254
Fax : +91 471 2700171

   .

ZestyBeanz Technologies Pvt Ltd
61/3236, Manikkath Cross Road
Ravipuram, Kochi, India - 682016
Phone: +91 484 4063254

  UAE

Zesty Labs
Office # 2003, Millennium Plaza Building
Sheikh Zayed Rd, Dubai, UAE
Phone: +971 4333 2222​
Mobile: +971-52-7553466

  Germany​

ZestyBeanz Technologies GmbH
Reuterstraße 1
90408 Nürnberg
Fon: +49 911 4801 444
Fax: +49 911 4801 445

Reply to comment

Contact Form


Lipin P's picture

Drupal API : Is she a monster?

From my small experience I have the feeling that the Drupal is mainly for developers. But one with high experience in non-Drupal PHP programing, will experience a starting trouble in Drupal development . They may complain that the drupal is complex because of the huge API. I have read some where a professional wrote : “Miss. Drupal, we are not born to study your API”. I admit that to a small extent. But is her API a monster?

For me the normal PHP coding style is like Bachelor's wild life where it always have enormous strength , no boundaries and wild ambitions. But my married friends said me that they love their married family life because of its own strength points. Then iI would like to call the drupal development is like the married family life. When we develop a drupal module we will have to use the API’s. First it may give you some problems & slow pace in your development. But as you proceed I am sure that One will start to love her API. After this when we switch back to plain PHP method we will find that you really miss Drupal API.

Comparing CMS systems like Joomla, magento,Drupal I have realized that when you have to add or remove something with out hacking the original code, Drupal have the easiest method because of its well defined API.

When we want to alter a form in Drupal.
In our own module which will have a module_name.module file you can write the code provided below. The module_name.info file will have a 10-15 lines.

<?php
&lt;?php
function my_module_form_alter(&amp;$form$form_state$form_id){
   switch (
$form_id){
       case
'user_adjustments_form':
       
$form['gen_pet_name'] = array(
         
'#type' =&gt'submit',
         
'#value' =&gtt('Generate'),
         
'#weight'=&gt;10,
       );
            
$form['#validate'][]='gen_pet_name_validate';

       
$form['#submit'][]='gen_pet_name_submit';


         break;
   }

}
?&
gt;

?>

will add a button “Generate ” to the form ‘user_adjustments_form’. In the function ‘gen_pet_name_submit’ we can write the submit actions. In ‘gen_pet_name_validate’ you can put your validating actions.
In the PHP development usually you will come across the table creation, pager, database queries etc
At that time you can simply use (according to the situations)

<?php
// For tables and pagers
      
$output_table.=theme('table'$header$body,array('class' =&gt'my_style’'),'Table heading');
       
$output_table.=theme('pager'NULL155,null,10);
// For updating or inserting database queries

 
db_query(&quot;UPDATE {table_nameSET subject '%s'body '%s'&quot;,$subject,$body);
 if (!
db_affected_rows()) {
 
db_query(&quot;INSERT INTO {table_name} (subject,bodyVALUES ('%s','%s')&quot;,
       
$subject$body);
    }

?>

Please look that 3-5 lines do the job .Isn’t that really nice? This is not that easy in case of systems like Joomla and Magento. Yes , it is right that these other families have their own strengths, mess exactly like Drupal family. But for developing Drupal provide some shortcuts. Through her API’s she is restricting you but provides another disciplined way to open up to communicate with your “family members “ and with other families.

In drupal there are some modules like Rules Views ,panels,OG &CCKwhich provide some additional powerful features to your CMS. I hope other CMS systems will adopt something like these

Everybody should take some Bachelor's life. All should go wild, do some awesome.But getting a married life will make your life better... I am sure. And joining Drupal family will be an excellent option.

WISH YOU A VERY HAPPY MARRIED LIFE...

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo], [[foo]]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.