shortcode-vc-text-separator.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once 'vc-icon-element.php';
  6. $icon_params = vc_icon_element_params();
  7. $icons_params = vc_map_integrate_shortcode( $icon_params, 'i_', esc_html__( 'Icon', 'js_composer' ), array(
  8. 'exclude' => array(
  9. 'align',
  10. 'css',
  11. 'el_class',
  12. 'el_id',
  13. 'link',
  14. 'css_animation',
  15. ),
  16. // we need only type, icon_fontawesome, icon_blabla..., NOT color and etc
  17. ), array(
  18. 'element' => 'add_icon',
  19. 'value' => 'true',
  20. ) );
  21. // populate integrated vc_icons params.
  22. if ( is_array( $icons_params ) && ! empty( $icons_params ) ) {
  23. foreach ( $icons_params as $key => $param ) {
  24. if ( is_array( $param ) && ! empty( $param ) ) {
  25. if ( isset( $param['admin_label'] ) ) {
  26. // remove admin label
  27. unset( $icons_params[ $key ]['admin_label'] );
  28. }
  29. }
  30. }
  31. }
  32. return array(
  33. 'name' => esc_html__( 'Separator with Text', 'js_composer' ),
  34. 'base' => 'vc_text_separator',
  35. 'icon' => 'icon-wpb-ui-separator-label',
  36. 'category' => esc_html__( 'Content', 'js_composer' ),
  37. 'description' => esc_html__( 'Horizontal separator line with heading', 'js_composer' ),
  38. 'params' => array_merge( array(
  39. array(
  40. 'type' => 'textfield',
  41. 'heading' => esc_html__( 'Title', 'js_composer' ),
  42. 'param_name' => 'title',
  43. 'holder' => 'div',
  44. 'value' => esc_html__( 'Title', 'js_composer' ),
  45. 'description' => esc_html__( 'Add text to separator.', 'js_composer' ),
  46. ),
  47. array(
  48. 'type' => 'checkbox',
  49. 'heading' => esc_html__( 'Add icon?', 'js_composer' ),
  50. 'param_name' => 'add_icon',
  51. ),
  52. ), $icons_params, array(
  53. array(
  54. 'type' => 'dropdown',
  55. 'heading' => esc_html__( 'Title position', 'js_composer' ),
  56. 'param_name' => 'title_align',
  57. 'value' => array(
  58. esc_html__( 'Center', 'js_composer' ) => 'separator_align_center',
  59. esc_html__( 'Left', 'js_composer' ) => 'separator_align_left',
  60. esc_html__( 'Right', 'js_composer' ) => 'separator_align_right',
  61. ),
  62. 'description' => esc_html__( 'Select title location.', 'js_composer' ),
  63. ),
  64. array(
  65. 'type' => 'dropdown',
  66. 'heading' => esc_html__( 'Separator alignment', 'js_composer' ),
  67. 'param_name' => 'align',
  68. 'value' => array(
  69. esc_html__( 'Center', 'js_composer' ) => 'align_center',
  70. esc_html__( 'Left', 'js_composer' ) => 'align_left',
  71. esc_html__( 'Right', 'js_composer' ) => 'align_right',
  72. ),
  73. 'description' => esc_html__( 'Select separator alignment.', 'js_composer' ),
  74. ),
  75. array(
  76. 'type' => 'dropdown',
  77. 'heading' => esc_html__( 'Color', 'js_composer' ),
  78. 'param_name' => 'color',
  79. 'value' => array_merge( vc_get_shared( 'colors' ), array( esc_html__( 'Custom color', 'js_composer' ) => 'custom' ) ),
  80. 'std' => 'grey',
  81. 'description' => esc_html__( 'Select color of separator.', 'js_composer' ),
  82. 'param_holder_class' => 'vc_colored-dropdown',
  83. ),
  84. array(
  85. 'type' => 'colorpicker',
  86. 'heading' => esc_html__( 'Custom Color', 'js_composer' ),
  87. 'param_name' => 'accent_color',
  88. 'description' => esc_html__( 'Custom separator color for your element.', 'js_composer' ),
  89. 'dependency' => array(
  90. 'element' => 'color',
  91. 'value' => array( 'custom' ),
  92. ),
  93. ),
  94. array(
  95. 'type' => 'dropdown',
  96. 'heading' => esc_html__( 'Style', 'js_composer' ),
  97. 'param_name' => 'style',
  98. 'value' => vc_get_shared( 'separator styles' ),
  99. 'description' => esc_html__( 'Separator display style.', 'js_composer' ),
  100. ),
  101. array(
  102. 'type' => 'dropdown',
  103. 'heading' => esc_html__( 'Border width', 'js_composer' ),
  104. 'param_name' => 'border_width',
  105. 'value' => vc_get_shared( 'separator border widths' ),
  106. 'description' => esc_html__( 'Select border width (pixels).', 'js_composer' ),
  107. ),
  108. array(
  109. 'type' => 'dropdown',
  110. 'heading' => esc_html__( 'Element width', 'js_composer' ),
  111. 'param_name' => 'el_width',
  112. 'value' => vc_get_shared( 'separator widths' ),
  113. 'description' => esc_html__( 'Separator element width in percents.', 'js_composer' ),
  114. ),
  115. vc_map_add_css_animation(),
  116. array(
  117. 'type' => 'el_id',
  118. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  119. 'param_name' => 'el_id',
  120. 'description' => sprintf( esc_html__( 'Enter element 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>' ),
  121. ),
  122. array(
  123. 'type' => 'textfield',
  124. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  125. 'param_name' => 'el_class',
  126. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  127. ),
  128. array(
  129. 'type' => 'hidden',
  130. 'param_name' => 'layout',
  131. 'value' => 'separator_with_text',
  132. ),
  133. array(
  134. 'type' => 'css_editor',
  135. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  136. 'param_name' => 'css',
  137. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  138. ),
  139. ) ),
  140. 'js_view' => 'VcTextSeparatorView',
  141. );