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
  • PHP

Classes

  • BaseControl
  • Button
  • Checkbox
  • HiddenField
  • ImageButton
  • 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 (http://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\Controls;
13: 
14: use Nette;
15: 
16: 
17: /**
18:  * Submittable image button form control.
19:  *
20:  * @author     David Grudl
21:  */
22: class ImageButton extends SubmitButton
23: {
24: 
25:     /**
26:      * @param  string  URI of the image
27:      * @param  string  alternate text for the image
28:      */
29:     public function __construct($src = NULL, $alt = NULL)
30:     {
31:         parent::__construct();
32:         $this->control->type = 'image';
33:         $this->control->src = $src;
34:         $this->control->alt = $alt;
35:     }
36: 
37: 
38:     /**
39:      * Returns HTML name of control.
40:      * @return string
41:      */
42:     public function getHtmlName()
43:     {
44:         $name = parent::getHtmlName();
45:         return strpos($name, '[') === FALSE ? $name : $name . '[]';
46:     }
47: 
48: 
49:     /**
50:      * Loads HTTP data.
51:      * @return void
52:      */
53:     public function loadHttpData()
54:     {
55:         $path = $this->getHtmlName(); // img_x or img['x']
56:         $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
57:         $this->setValue(Nette\Utils\Arrays::get($this->getForm()->getHttpData(), $path, NULL));
58:     }
59: 
60: }
61: 
Nette Framework 2.0.12 API API documentation generated by ApiGen 2.8.0