SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/gallery_widget_settings.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\Form;
  4.  
  5. $unique = md5(microtime(true));
  6. ?>
  7.  
  8. <div class="js--<?php echo Enc::html($unique); ?>">
  9. <div class="field-group-wrap -clearfix">
  10. <div class="field-group-item col col--one-half">
  11. <?php
  12. Form::nextFieldDetails('Category', true);
  13. echo Form::dropdown('category', [], $cats);
  14. ?>
  15. </div>
  16. <div class="field-group-item col col--one-half">
  17. <?php
  18. Form::nextFieldDetails('Display order', true);
  19. echo Form::dropdown('order', [], $ordering);
  20. ?>
  21. </div>
  22. </div>
  23.  
  24. <div class="field-group-wrap -clearfix">
  25. <div class="field-group-item col col--one-half">
  26. <?php
  27. Form::nextFieldDetails('Max number of images to show', true);
  28. echo Form::text('limit');
  29. ?>
  30. </div>
  31. <div class="field-group-item col col--one-half">
  32. <?php
  33. Form::nextFieldDetails('Captions', true);
  34. echo Form::dropdown('captions', [], ['0' => 'No', '1' => 'Yes']);
  35. ?>
  36. </div>
  37. </div>
  38.  
  39. <div class="field-group-wrap -clearfix">
  40. <div class="field-group-item col col--one-half">
  41. <?php
  42. Form::nextFieldDetails('Cropping anchor', false);
  43. echo Form::dropdown('cropping', [], $cropping);
  44. ?>
  45. </div>
  46. <div class="field-group-item col col--one-half">
  47. <?php
  48. Form::nextFieldDetails('Gallery type', false);
  49. echo Form::dropdown('display_opts', ['class' => 'js--display-opts'], $display);
  50. ?>
  51. </div>
  52. </div>
  53.  
  54. <div class="js--settings-grid">
  55. <div class="field-group-wrap -clearfix">
  56. <?php
  57. Form::nextFieldDetails('Thumbnails per row', false);
  58. echo Form::dropdown('thumb_rows', [], ['2' => '2', '3' => '3', '4' => '4', '5' => '5']);
  59. ?>
  60. </div>
  61. </div>
  62.  
  63. <div class="js--settings-slider">
  64. <div class="field-group-wrap -clearfix">
  65. <div class="field-group-item col col--one-half">
  66. <?php
  67. Form::nextFieldDetails('Slider options', false);
  68. echo Form::checkboxList(['slider_dots' => 'Dots', 'slider_arrows' => 'Arrows', 'slider_autoplay' => 'Auto-scroll'], []);
  69. ?>
  70. </div>
  71. <div class="field-group-item col col--one-half">
  72. <?php
  73. Form::nextFieldDetails('Auto-scroll timer', false, 'Seconds');
  74. echo Form::number('slider_speed', []);
  75. ?>
  76.  
  77. <?php
  78. Form::nextFieldDetails('Images per slide', false);
  79. echo Form::dropdown('num_images', [], ['1' => '1', '2' => '2', '3' => '3', '4' => '4']);
  80. ?>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85.  
  86. <script>
  87. $(document).ready(function() {
  88. var unique = '<?php echo Enc::js($unique); ?>';
  89.  
  90. $('.js--' + unique + ' .js--display-opts').on('change', function() {
  91. if ($(this).val() == 'grid') {
  92. $('.js--' + unique + ' .js--settings-grid').show();
  93. $('.js--' + unique + ' .js--settings-slider').hide();
  94. } else if ($(this).val() == 'slider') {
  95. $('.js--' + unique + ' .js--settings-grid').hide();
  96. $('.js--' + unique + ' .js--settings-slider').show();
  97. } else {
  98. $('.js--' + unique + ' .js--settings-grid').hide();
  99. $('.js--' + unique + ' .js--settings-slider').hide();
  100. }
  101. });
  102.  
  103. $('.js--' + unique + ' .js--display-opts').change();
  104. })
  105. </script>
  106.