Show
Ignore:
Timestamp:
02/05/2008 08:49:08 AM (11 months ago)
Author:
Shadowhand
Message:

Added comments for Forge and Form_Input (other files don't need comments, they are all extensions), and set properties.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/forge/libraries/Forge.php

    • Property copyright changed from Copyright (c) 2007 Kohana Team to Copyright (c) 2007-2008 Kohana Team
    r1917 r1923  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    2  
     2/** 
     3 * FORGE (FORm GEneration) library. 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @package    Forge 
     8 * @author     Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
     10 * @license    http://kohanaphp.com/license.html 
     11 */ 
    312class Forge_Core { 
    413 
     
    2332        public $newline_char = "\n"; 
    2433 
     34        /** 
     35         * Form constructor. Sets the form action, title, method, and attributes. 
     36         * 
     37         * @return  void 
     38         */ 
    2539        public function __construct($action = '', $title = '', $method = NULL, $attr = array()) 
    2640        { 
     
    4256        } 
    4357 
     58        /** 
     59         * Magic __get method. Returns the specified form element. 
     60         * 
     61         * @param   string   unique input name 
     62         * @return  object 
     63         */ 
    4464        public function __get($key) 
    4565        { 
     
    5474        } 
    5575 
     76        /** 
     77         * Magic __call method. Creates a new form element object. 
     78         * 
     79         * @throws  Kohana_Exception 
     80         * @param   string   input type 
     81         * @param   string   input name 
     82         * @return  object 
     83         */ 
    5684        public function __call($method, $args) 
    5785        { 
     
    96124        } 
    97125 
     126        /** 
     127         * Set a form attribute. This method is chainable. 
     128         * 
     129         * @param   string|array  attribute name, or an array of attributes 
     130         * @param   string        attribute value 
     131         * @return  object 
     132         */ 
     133        public function set_attr($key, $val = NULL) 
     134        { 
     135                if (is_array($key)) 
     136                { 
     137                        // Merge the new attributes with the old ones 
     138                        $this->attr = array_merge($this->attr, $key); 
     139                } 
     140                else 
     141                { 
     142                        // Set the new attribute 
     143                        $this->attr[$key] = $val; 
     144                } 
     145 
     146                return $this; 
     147        } 
     148 
     149        /** 
     150         * Validates the form by running each inputs validation rules. 
     151         * 
     152         * @return  bool 
     153         */ 
    98154        public function validate() 
    99155        { 
     
    110166        } 
    111167 
     168        /** 
     169         * Returns the form as an array of input names and values. 
     170         * 
     171         * @return  array 
     172         */ 
    112173        public function as_array() 
    113174        { 
     
    124185        } 
    125186 
     187        /** 
     188         * Changes the error message format. Your message formatting must 
     189         * contain a {message} placeholder. 
     190         * 
     191         * @throws  Kohana_Exception 
     192         * @param   string   new message format 
     193         * @return  void 
     194         */ 
    126195        public function error_format($string = '') 
    127196        {