shortcode-vc-tta-section.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. $parent_tag = vc_post_param( 'parent_tag', '' );
  6. $include_icon_params = ( 'vc_tta_pageable' !== $parent_tag );
  7. if ( $include_icon_params ) {
  8. require_once vc_path_dir( 'CONFIG_DIR', 'content/vc-icon-element.php' );
  9. $icon_params = array(
  10. array(
  11. 'type' => 'checkbox',
  12. 'param_name' => 'add_icon',
  13. 'heading' => esc_html__( 'Add icon?', 'js_composer' ),
  14. 'description' => esc_html__( 'Add icon next to section title.', 'js_composer' ),
  15. ),
  16. array(
  17. 'type' => 'dropdown',
  18. 'param_name' => 'i_position',
  19. 'value' => array(
  20. esc_html__( 'Before title', 'js_composer' ) => 'left',
  21. esc_html__( 'After title', 'js_composer' ) => 'right',
  22. ),
  23. 'dependency' => array(
  24. 'element' => 'add_icon',
  25. 'value' => 'true',
  26. ),
  27. 'heading' => esc_html__( 'Icon position', 'js_composer' ),
  28. 'description' => esc_html__( 'Select icon position.', 'js_composer' ),
  29. ),
  30. );
  31. $icon_params = array_merge( $icon_params, (array) vc_map_integrate_shortcode( vc_icon_element_params(), 'i_', '', array(
  32. // we need only type, icon_fontawesome, icon_.., NOT color and etc
  33. 'include_only_regex' => '/^(type|icon_\w*)/',
  34. ), array(
  35. 'element' => 'add_icon',
  36. 'value' => 'true',
  37. ) ) );
  38. } else {
  39. $icon_params = array();
  40. }
  41. $params = array_merge( array(
  42. array(
  43. 'type' => 'textfield',
  44. 'param_name' => 'title',
  45. 'heading' => esc_html__( 'Title', 'js_composer' ),
  46. 'description' => esc_html__( 'Enter section title (Note: you can leave it empty).', 'js_composer' ),
  47. ),
  48. array(
  49. 'type' => 'el_id',
  50. 'param_name' => 'tab_id',
  51. 'settings' => array(
  52. 'auto_generate' => true,
  53. ),
  54. 'heading' => esc_html__( 'Section ID', 'js_composer' ),
  55. 'description' => sprintf( esc_html__( 'Enter section ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'js_composer' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ),
  56. ),
  57. ), $icon_params, array(
  58. array(
  59. 'type' => 'textfield',
  60. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  61. 'param_name' => 'el_class',
  62. 'description' => esc_html__( 'If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer' ),
  63. ),
  64. ) );
  65. return array(
  66. 'name' => esc_html__( 'Section', 'js_composer' ),
  67. 'base' => 'vc_tta_section',
  68. 'icon' => 'icon-wpb-ui-tta-section',
  69. 'allowed_container_element' => 'vc_row',
  70. 'is_container' => true,
  71. 'show_settings_on_create' => false,
  72. 'as_child' => array(
  73. 'only' => 'vc_tta_tour,vc_tta_tabs,vc_tta_accordion',
  74. ),
  75. 'category' => esc_html__( 'Content', 'js_composer' ),
  76. 'description' => esc_html__( 'Section for Tabs, Tours, Accordions.', 'js_composer' ),
  77. 'params' => $params,
  78. 'js_view' => 'VcBackendTtaSectionView',
  79. 'custom_markup' => '
  80. <div class="vc_tta-panel-heading">
  81. <h4 class="vc_tta-panel-title vc_tta-controls-icon-position-left"><a href="javascript:;" data-vc-target="[data-model-id=\'{{ model_id }}\']" data-vc-accordion data-vc-container=".vc_tta-container"><span class="vc_tta-title-text">{{ section_title }}</span><i class="vc_tta-controls-icon vc_tta-controls-icon-plus"></i></a></h4>
  82. </div>
  83. <div class="vc_tta-panel-body">
  84. {{ editor_controls }}
  85. <div class="{{ container-class }}">
  86. {{ content }}
  87. </div>
  88. </div>',
  89. 'default_content' => '',
  90. );