Fix for Half OOP FAPI: no methods

  1. <?php
  2.  
  3. class DrupalInputElement extends ArrayObject {
  4.   /**
  5.    * This elements accepts user input.
  6.    */
  7.   protected $input = TRUE;
  8.   public $default_value;
  9.   function __construct($args) {
  10.     foreach ($args as $k => $v) {
  11.       $this->$k = $v;
  12.     }
  13.   }
  14. }
  15.  
  16. class DrupalTextField extends DrupalInputElement {
  17.   public $size;
  18.  
  19. }
  20.  
  21. $a = new DrupalTextField(array(
  22.   'size' => 10,
  23.   'default_value' => 'foo',
  24. ));
  25.  
  26. $a['child1'] = new DrupalTextField(array(
  27.   'size' => 20,
  28.   'default_value' => 'bar',
  29. ));

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.