SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/EmailTextReg.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. class EmailTextReg
  17. {
  18. private $field_defs;
  19. private $default_html_view;
  20.  
  21.  
  22. /**
  23.   * Register an email text
  24.   *
  25.   * @param array $field_defs An array of name => description field definitions, for the admin
  26.   * e.g. array('first_name' => 'First name of the new user)
  27.   *
  28.   * @param string $default_html_view The view name for the default text. Must be a .htm view
  29.   * e.g 'email/user_welcome'
  30.   **/
  31. public function __construct(array $field_defs, $default_html_view)
  32. {
  33. $this->field_defs = $field_defs;
  34. $this->default_html_view = $default_html_view;
  35. }
  36.  
  37.  
  38. /**
  39.   * An array of name => description field definitions, for the admin
  40.   **/
  41. public function getFieldDefs()
  42. {
  43. return $this->field_defs;
  44. }
  45.  
  46.  
  47. /**
  48.   * Returns the HTML for the default content
  49.   * This is loaded from a .htm view
  50.   **/
  51. public function getDefaultHTML()
  52. {
  53. $default = new View($this->default_html_view);
  54. return $default->render();
  55. }
  56.  
  57. }
  58.  
  59.