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