Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

  • BaseControl
  • Button
  • Checkbox
  • HiddenField
  • ImageButton
  • MultiSelectBox
  • RadioList
  • SelectBox
  • SubmitButton
  • TextArea
  • TextBase
  • TextInput
  • UploadControl
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Forms\Controls;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Check box control. Allows the user to select a true or false condition.
15:  *
16:  * @author     David Grudl
17:  */
18: class Checkbox extends BaseControl
19: {
20: 
21:     /**
22:      * @param  string  label
23:      */
24:     public function __construct($label = NULL)
25:     {
26:         parent::__construct($label);
27:         $this->control->type = 'checkbox';
28:         $this->value = FALSE;
29:     }
30: 
31: 
32:     /**
33:      * Sets control's value.
34:      * @param  bool
35:      * @return self
36:      */
37:     public function setValue($value)
38:     {
39:         $this->value = is_scalar($value) ? (bool) $value : FALSE;
40:         return $this;
41:     }
42: 
43: 
44:     /**
45:      * Generates control's HTML element.
46:      * @return Nette\Utils\Html
47:      */
48:     public function getControl()
49:     {
50:         return parent::getControl()->checked($this->value);
51:     }
52: 
53: }
54: 
Nette 2.0 API documentation generated by ApiGen 2.8.0