SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/page_add.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16. use Sprout\Helpers\Admin;
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\Form;
  19. use Sprout\Helpers\NavigationGroups;
  20. use Sprout\Helpers\Needs;
  21. use Sprout\Helpers\Register;
  22. use Sprout\Helpers\Subsites;
  23.  
  24.  
  25. Needs::fileGroup('sprout/page_edit');
  26.  
  27. Form::setData($data);
  28. Form::setErrors($errors);
  29. ?>
  30.  
  31.  
  32. <h3>Page details</h3>
  33.  
  34. <input type="hidden" name="type" value="<?= Enc::html($data['type']); ?>">
  35.  
  36. <?php
  37. Form::nextFieldDetails('Name', true, 'This name will appear as the primary heading of this page, and will also be used in your navigation and sitemap');
  38. echo Form::text('name', ['-wrapper-class' => 'white', 'spellcheck' => 'true']);
  39. ?>
  40.  
  41. <?php
  42. Form::nextFieldDetails('Parent page', false, 'The location in your navigation where this page will be displayed');
  43. echo Form::pageDropdown('parent_id', ['-wrapper-class' => 'white']);
  44. ?>
  45.  
  46. <?php if ($data['type'] == 'tool'): ?>
  47. <?php Form::nextFieldDetails('Module', true); ?>
  48. <?= Form::dropdown('controller_entrance', ['-wrapper-class' => 'white'], $front_end_controllers); ?>
  49.  
  50. <?php Form::nextFieldDetails('Option', true); ?>
  51. <?= Form::dropdown('controller_argument', ['-wrapper-class' => 'white'], $controller_arguments); ?>
  52. <?php endif; ?>
  53.  
  54. <?php if (Subsites::getConfigAdmin('nav_groups') !== null): ?>
  55. <?php
  56. Form::nextFieldDetails('Menu group', false, 'The group to place this page into in the main navigation menu');
  57. echo Form::dropdown('menu_group', ['-dropdown-top' => 'None -- Top level page', '-wrapper-class' => 'white'], NavigationGroups::getAllNamesAdmin());
  58. ?>
  59. <?php endif; ?>
  60.  
  61. <?php
  62. Form::nextFieldDetails('Search engine description', false, 'The description to show in search results from search engines like Google. Treat it as an advertisement for this page');
  63. echo Form::text('meta_description', ['-wrapper-class' => 'white', 'spellcheck' => 'true']);
  64. ?>
  65.  
  66.  
  67. <?php if (Register::hasFeature('users')): ?>
  68. <h3>Who can view this page?</h3>
  69. <div class="info">You can restrict which user groups can access this page.</div>
  70. <?php
  71. echo Form::multiradio('user_perm_specific', [], [
  72. 0 => 'Anyone who can view the parent page',
  73. 1 => 'Choose specific user groups',
  74. ]);
  75. ?>
  76. <div class="user_perms">
  77. <?php
  78. echo Form::checkboxSet('user_permissions[]', [], $user_category_options);
  79. ?>
  80. </div>
  81. <?php endif; ?>
  82.  
  83.  
  84. <h3>Who can manage this page?</h3>
  85. <div class="info">You can restrict which operator groups can edit this page.</div>
  86. <?php
  87. echo Form::multiradio('admin_perm_specific', [], [
  88. 0 => 'Anyone who can manage the parent page',
  89. 1 => 'Choose specific operator groups',
  90. ]);
  91. ?>
  92. <div class="admin_perms">
  93. <?php
  94. echo Form::checkboxSet('admin_permissions[]', [], $admin_category_options);
  95. ?>
  96. </div>
  97.  
  98.  
  99. <?php if ($data['type'] != 'tool'): ?>
  100. <br>
  101. <div class="info highlight-confirm">You will be able to enter your page content in the next step.</div>
  102. <?php endif; ?>
  103.  
  104.  
  105. <?php Admin::clearFieldErrors(); ?>
  106.