SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/auto_edit.php

  1. <?php
  2. use Sprout\Helpers\Admin;
  3. use Sprout\Helpers\Enc;
  4. use Sprout\Helpers\Fb;
  5. use Sprout\Helpers\Form;
  6. use Sprout\Helpers\JsonForm;
  7.  
  8.  
  9.  
  10. Form::setData($data);
  11. Form::setErrors($errors);
  12.  
  13. if (!isset($for)) {
  14. $for = ($id == 0 ? 'add' : 'edit');
  15. }
  16. ?>
  17.  
  18.  
  19. <div class="main-tabs">
  20. <?php if (count($config) > 1): ?>
  21. <ul>
  22. <?php foreach ($config as $tab => $tab_content): ?>
  23. <li><a href="#main-tabs-<?= Enc::id($tab); ?>"><?= Enc::html($tab); ?></a></li>
  24. <?php endforeach; ?>
  25. </ul>
  26. <?php endif; ?>
  27.  
  28. <?php foreach ($config as $tab => $tab_content): ?>
  29. <div class="tab" id="main-tabs-<?= Enc::id($tab); ?>">
  30. <?php
  31. if (is_array($tab_content)) {
  32. foreach ($tab_content as $item) {
  33. echo JsonForm::renderTabItem($item, $for, $id, $data, $errors);
  34. }
  35. } elseif ($tab_content == 'categories') {
  36. echo Fb::heading('Categories');
  37. echo Admin::categorySelection('categories[]', $cats, $data['categories']);
  38. }
  39. ?>
  40. </div>
  41. <?php endforeach; ?>
  42. </div>
  43.  
  44.