Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • Button
  • Checkbox
  • ConventionalRenderer
  • FileUpload
  • Form
  • FormContainer
  • FormControl
  • FormGroup
  • HiddenField
  • ImageButton
  • InstantClientScript
  • MultiSelectBox
  • RadioList
  • Rule
  • Rules
  • SelectBox
  • SubmitButton
  • TextArea
  • TextBase
  • TextInput

Interfaces

  • IFormControl
  • IFormRenderer
  • INamingContainer
  • ISubmitterControl
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  */
11: 
12: namespace Nette\Forms;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * Submittable image button form control.
20:  *
21:  * @author     David Grudl
22:  */
23: class ImageButton extends SubmitButton
24: {
25: 
26:     /**
27:      * @param  string  URI of the image
28:      * @param  string  alternate text for the image
29:      */
30:     public function __construct($src = NULL, $alt = NULL)
31:     {
32:         parent::__construct();
33:         $this->control->type = 'image';
34:         $this->control->src = $src;
35:         $this->control->alt = $alt;
36:     }
37: 
38: 
39: 
40:     /**
41:      * Returns name of control within a Form & INamingContainer scope.
42:      * @return string
43:      */
44:     public function getHtmlName()
45:     {
46:         $name = parent::getHtmlName();
47:         return strpos($name, '[') === FALSE ? $name : $name . '[]';
48:     }
49: 
50: 
51: 
52:     /**
53:      * Loads HTTP data.
54:      * @return void
55:      */
56:     public function loadHttpData()
57:     {
58:         $path = $this->getHtmlName(); // img_x or img['x']
59:         $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
60:         $this->setValue(Nette\ArrayTools::get($this->getForm()->getHttpData(), $path) !== NULL);
61:     }
62: 
63: }
64: 
Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0