SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/RefineWidgetTextbox.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13.  
  14. namespace Sprout\Helpers;
  15.  
  16. /**
  17. * A textbox widget
  18. **/
  19. class RefineWidgetTextbox extends RefineWidget
  20. {
  21.  
  22. /**
  23.   * Draws the widget.
  24.   * @return string The HTML for the widget.
  25.   **/
  26. public function render()
  27. {
  28. $name = Enc::html($this->name);
  29. $label = Enc::html($this->label);
  30. $value = Enc::html($this->getValue());
  31.  
  32. $out = "<div class=\"field-element field-element--text field-element--small field-element--white refine-bar-{$name}\">";
  33. $out .= "<div class=\"field-label\">";
  34. $out .= "<label for=\"field1\">{$label}</label>";
  35. $out .= "</div>";
  36. $out .= "<div class=\"field-input\">";
  37. $out .= "<input type=\"text\" class=\"textbox\" name=\"{$name}\" value=\"{$value}\">";
  38. $out .= "</div>";
  39. $out .= "</div>";
  40.  
  41. return $out;
  42. }
  43.  
  44. }
  45.  
  46.  
  47.