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/Form_Input.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 base input 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 Form_Input_Core { 
    413 
     
    2938        protected $error_messages = array(); 
    3039 
     40        /** 
     41         * Sets the input element name. 
     42         */ 
    3143        public function __construct($name) 
    3244        { 
     
    3446        } 
    3547 
     48        /** 
     49         * Sets form attributes, or return rules. 
     50         */ 
    3651        public function __call($method, $args) 
    3752        { 
     
    7085        } 
    7186 
     87        /** 
     88         * Returns form attributes. 
     89         * 
     90         * @param   string  attribute name 
     91         * @return  string 
     92         */ 
    7293        public function __get($key) 
    7394        { 
     
    7899        } 
    79100 
     101        /** 
     102         * Sets a form element that this element must match the value of. 
     103         * 
     104         * @chainable 
     105         * @param   object  another Forge input 
     106         * @return  object 
     107         */ 
    80108        public function matches($input) 
    81109        { 
     
    88116        } 
    89117 
     118        /** 
     119         * Sets a callback method as a rule for this input. 
     120         * 
     121         * @chainable 
     122         * @param   callback 
     123         * @return  object 
     124         */ 
    90125        public function callback($callback) 
    91126        { 
     
    98133        } 
    99134 
     135        /** 
     136         * Sets or returns the input label. 
     137         * 
     138         * @chainable 
     139         * @param   string   label to set 
     140         * @return  string|object 
     141         */ 
    100142        public function label($val = NULL) 
    101143        { 
     
    115157        } 
    116158 
     159        /** 
     160         * Set or return the error message. 
     161         * 
     162         * @chainable 
     163         * @param   string  error message 
     164         * @return  strong|object 
     165         */ 
    117166        public function message($val = NULL) 
    118167        { 
     
    129178        } 
    130179 
     180        /** 
     181         * Runs validation and returns the element HTML. 
     182         * 
     183         * @return  string 
     184         */ 
    131185        public function html() 
    132186        { 
     
    137191        } 
    138192 
     193        /** 
     194         * Returns the form input HTML. 
     195         * 
     196         * @return  string 
     197         */ 
    139198        protected function html_element() 
    140199        { 
     
    147206        } 
    148207 
     208        /** 
     209         * Replace, remove, or append rules. 
     210         * 
     211         * @param   array   rules to change 
     212         * @param   string  action to use: replace, remove, append 
     213         */ 
    149214        protected function add_rules( array $rules, $action) 
    150215        { 
     
    183248        } 
    184249 
     250        /** 
     251         * Add an error to the input. 
     252         * 
     253         * @chainable 
     254         * @return object 
     255         */ 
    185256        public function add_error($key, $val) 
    186257        { 
     
    193264        } 
    194265 
     266        /** 
     267         * Set or return the error messages. 
     268         * 
     269         * @chainable 
     270         * @param   string|array  failed validation function, or an array of messages 
     271         * @param   string        error message 
     272         * @return  object|array 
     273         */ 
    195274        public function error_messages($func = NULL, $message = NULL) 
    196275        { 
     
    281360        } 
    282361 
     362        /** 
     363         * Get the global input value. 
     364         * 
     365         * @return  string|bool 
     366         */ 
    283367        protected function input_value() 
    284368        { 
     
    297381        } 
    298382 
     383        /** 
     384         * Load the value of the input, if form data is present. 
     385         * 
     386         * @return  void 
     387         */ 
    299388        protected function load_value() 
    300389        { 
     
    315404        } 
    316405 
     406        /** 
     407         * Validate this input based on the set rules. 
     408         * 
     409         * @return  bool 
     410         */ 
    317411        public function validate() 
    318412        { 
     
    424518        } 
    425519 
     520        /** 
     521         * Validate required. 
     522         */ 
    426523        protected function rule_required() 
    427524        { 
     
    432529        } 
    433530 
     531        /** 
     532         * Validate length. 
     533         */ 
    434534        protected function rule_length($min, $max = NULL) 
    435535        {