Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

Classes

  • BaseControl
  • Button
  • Checkbox
  • CheckboxList
  • ChoiceControl
  • CsrfProtection
  • HiddenField
  • ImageButton
  • MultiChoiceControl
  • MultiSelectBox
  • RadioList
  • SelectBox
  • SubmitButton
  • TextArea
  • TextBase
  • TextInput
  • UploadControl
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Forms\Controls;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Push button control with no default behavior.
15:  */
16: class Button extends BaseControl
17: {
18: 
19:     /**
20:      * @param  string  caption
21:      */
22:     public function __construct($caption = NULL)
23:     {
24:         parent::__construct($caption);
25:         $this->control->type = 'button';
26:         $this->setOption('type', 'button');
27:     }
28: 
29: 
30:     /**
31:      * Is button pressed?
32:      * @return bool
33:      */
34:     public function isFilled()
35:     {
36:         $value = $this->getValue();
37:         return $value !== NULL && $value !== [];
38:     }
39: 
40: 
41:     /**
42:      * Bypasses label generation.
43:      * @return void
44:      */
45:     public function getLabel($caption = NULL)
46:     {
47:         return NULL;
48:     }
49: 
50: 
51:     /**
52:      * Generates control's HTML element.
53:      * @param  string
54:      * @return Nette\Utils\Html
55:      */
56:     public function getControl($caption = NULL)
57:     {
58:         $this->setOption('rendered', TRUE);
59:         $el = clone $this->control;
60:         return $el->addAttributes([
61:             'name' => $this->getHtmlName(),
62:             'disabled' => $this->isDisabled(),
63:             'value' => $this->translate($caption === NULL ? $this->caption : $caption),
64:         ]);
65:     }
66: 
67: }
68: 
Nette 2.4-20170119 API API documentation generated by ApiGen 2.8.0