SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/TextareaRichText.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. * @package Admin
  18. **/
  19.  
  20. /**
  21. * Interface the display of a richtext field
  22. **/
  23. class TextareaRichText extends RichText
  24. {
  25.  
  26. /**
  27.   * Shows a richtext field. Should output content directly
  28.   *
  29.   * @param string $field_name The field name
  30.   * @param string $content The content of the richtext field, in HTML
  31.   * @param int $width The width of the field, in pixels
  32.   * @param int $height The height of the field, in pixels
  33.   * @param string $config_group Unused in this class
  34.   **/
  35. protected function drawInternal($field_name, $content, $width = 600, $height = 300, $config_group = null)
  36. {
  37. $field_name = Enc::html($field_name);
  38. $content = Enc::html($content);
  39.  
  40. echo "<p><small>Enter HTML into the box below.</small></p>\n";
  41. echo "<textarea name=\"{$field_name}\" style=\"width: {$width}px; height: {$height}px;\">{$content}</textarea>\n";
  42. }
  43.  
  44. }
  45.  
  46.  
  47.