PageRenderTime 48ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/docroot/themes/custom/gavias_linoor/gva_content_builder/gva_quotes_rotator.php

https://gitlab.com/kryber/wizionary
PHP | 125 lines | 120 code | 4 blank | 1 comment | 10 complexity | 2dafe73b9eb837617334a3ec3723b405 MD5 | raw file
  1. <?php
  2. if(!class_exists('element_gva_quotes_rotator')):
  3. class element_gva_quotes_rotator{
  4. public function render_form(){
  5. $fields = array(
  6. 'title' => t('Quotes Rotator'),
  7. //'key' => 'gva_quotes_rotator',
  8. 'fields' => array(
  9. array(
  10. 'id' => 'title',
  11. 'type' => 'text',
  12. 'title' => t('Title'),
  13. 'admin' => true
  14. ),
  15. array(
  16. 'id' => 'skin_text',
  17. 'type' => 'select',
  18. 'title' => 'Skin Text for box',
  19. 'options' => array(
  20. 'text-dark' => t('Text Dark'),
  21. 'text-light' => t('Text Light')
  22. )
  23. ),
  24. array(
  25. 'id' => 'max_width',
  26. 'type' => 'text',
  27. 'title' => t('Max Width'),
  28. 'desc' => 'e.g: 600px'
  29. ),
  30. array(
  31. 'id' => 'min_height',
  32. 'type' => 'text',
  33. 'title' => t('Min Height'),
  34. 'desc' => 'e.g: 200px'
  35. ),
  36. array(
  37. 'id' => 'animate',
  38. 'type' => 'select',
  39. 'title' => t('Animation'),
  40. 'desc' => t('Entrance animation for element'),
  41. 'options' => gavias_content_builder_animate(),
  42. 'class' => 'width-1-2'
  43. ),
  44. array(
  45. 'id' => 'animate_delay',
  46. 'type' => 'select',
  47. 'title' => t('Animation Delay'),
  48. 'options' => gavias_content_builder_delay_wow(),
  49. 'desc' => '0 = default',
  50. 'class' => 'width-1-2'
  51. ),
  52. array(
  53. 'id' => 'el_class',
  54. 'type' => 'text',
  55. 'title' => t('Extra class name'),
  56. 'desc' => t('Style particular content element differently - add a class name and refer to it in custom CSS.'),
  57. )
  58. )
  59. );
  60. for($i=1; $i<=10; $i++){
  61. $fields['fields'][] = array(
  62. 'id' => "info_${i}",
  63. 'type' => 'info',
  64. 'desc' => "Information for item {$i}"
  65. );
  66. $fields['fields'][] = array(
  67. 'id' => "title_{$i}",
  68. 'type' => 'text',
  69. 'title' => t("Title {$i}")
  70. );
  71. $fields['fields'][] = array(
  72. 'id' => "content_{$i}",
  73. 'type' => 'textarea',
  74. 'title' => t("Content {$i}")
  75. );
  76. }
  77. return $fields;
  78. }
  79. public static function render_content( $attr = array(), $content = '' ){
  80. $default = array(
  81. 'title' => '',
  82. 'skin_text' => 'text-dark',
  83. 'max_width' => '',
  84. 'min_height' => '',
  85. 'animate' => '',
  86. 'animate_delay' => '',
  87. 'el_class' => ''
  88. );
  89. for($i=1; $i<=10; $i++){
  90. $default["title_{$i}"] = '';
  91. $default["content_{$i}"] = '';
  92. }
  93. extract(gavias_merge_atts($default, $attr));
  94. $style = '';
  95. if($max_width) $style .= "max-width:{$max_width};";
  96. if($min_height) $style .= "min-height:{$min_height};";
  97. if($style) $style = " style=\"{$style}\"";
  98. if($animate) $el_class .= ' wow ' . $animate;
  99. ob_start();
  100. ?>
  101. <div class="gsc-quotes-rotator <?php print $skin_text ?> <?php print $el_class ?>" <?php print gavias_content_builder_print_animate_wow('', $animate_delay) ?>>
  102. <div class="cbp-qtrotator"<?php print $style ?>>
  103. <?php for($i=1; $i<=10; $i++){ ?>
  104. <?php
  105. $title = "title_{$i}";
  106. $content = "content_{$i}";
  107. ?>
  108. <?php if($$title){ ?>
  109. <div class="cbp-qtcontent">
  110. <div class="content-title"><?php print $$title ?></div>
  111. <div class="content-inner"><?php print $$content ?></div>
  112. </div>
  113. <?php } ?>
  114. <?php } ?>
  115. </div>
  116. </div>
  117. <?php return ob_get_clean() ?>
  118. <?php
  119. }
  120. }
  121. endif;