Packages

  • 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

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