shortcode-vc-toggle.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once vc_path_dir( 'CONFIG_DIR', 'content/vc-custom-heading-element.php' );
  6. $cta_custom_heading = vc_map_integrate_shortcode( vc_custom_heading_element_params(), 'custom_', esc_html__( 'Heading', 'js_composer' ), array(
  7. 'exclude' => array(
  8. 'source',
  9. 'text',
  10. 'css',
  11. 'link',
  12. ),
  13. ), array(
  14. 'element' => 'use_custom_heading',
  15. 'value' => 'true',
  16. ) );
  17. $params = array_merge( array(
  18. array(
  19. 'type' => 'textfield',
  20. 'holder' => 'h4',
  21. 'class' => 'vc_toggle_title',
  22. 'heading' => esc_html__( 'Toggle title', 'js_composer' ),
  23. 'param_name' => 'title',
  24. 'value' => esc_html__( 'Toggle title', 'js_composer' ),
  25. 'description' => esc_html__( 'Enter title of toggle block.', 'js_composer' ),
  26. 'edit_field_class' => 'vc_col-sm-9',
  27. ),
  28. array(
  29. 'type' => 'checkbox',
  30. 'heading' => esc_html__( 'Use custom font?', 'js_composer' ),
  31. 'param_name' => 'use_custom_heading',
  32. 'description' => esc_html__( 'Enable Google fonts.', 'js_composer' ),
  33. 'edit_field_class' => 'vc_col-sm-3',
  34. ),
  35. array(
  36. 'type' => 'textarea_html',
  37. 'holder' => 'div',
  38. 'class' => 'vc_toggle_content',
  39. 'heading' => esc_html__( 'Toggle content', 'js_composer' ),
  40. 'param_name' => 'content',
  41. 'value' => '<p>' . esc_html__( 'Toggle content goes here, click edit button to change this text.', 'js_composer' ) . '</p>',
  42. 'description' => esc_html__( 'Toggle block content.', 'js_composer' ),
  43. ),
  44. array(
  45. 'type' => 'dropdown',
  46. 'heading' => esc_html__( 'Style', 'js_composer' ),
  47. 'param_name' => 'style',
  48. 'value' => vc_get_shared( 'toggle styles' ),
  49. 'description' => esc_html__( 'Select toggle design style.', 'js_composer' ),
  50. ),
  51. array(
  52. 'type' => 'dropdown',
  53. 'heading' => esc_html__( 'Icon color', 'js_composer' ),
  54. 'param_name' => 'color',
  55. 'value' => array( esc_html__( 'Default', 'js_composer' ) => 'default' ) + vc_get_shared( 'colors' ),
  56. 'description' => esc_html__( 'Select icon color.', 'js_composer' ),
  57. 'param_holder_class' => 'vc_colored-dropdown',
  58. ),
  59. array(
  60. 'type' => 'dropdown',
  61. 'heading' => esc_html__( 'Size', 'js_composer' ),
  62. 'param_name' => 'size',
  63. 'value' => array_diff_key( vc_get_shared( 'sizes' ), array( 'Mini' => '' ) ),
  64. 'std' => 'md',
  65. 'description' => esc_html__( 'Select toggle size', 'js_composer' ),
  66. ),
  67. array(
  68. 'type' => 'dropdown',
  69. 'heading' => esc_html__( 'Default state', 'js_composer' ),
  70. 'param_name' => 'open',
  71. 'value' => array(
  72. esc_html__( 'Closed', 'js_composer' ) => 'false',
  73. esc_html__( 'Open', 'js_composer' ) => 'true',
  74. ),
  75. 'description' => esc_html__( 'Select "Open" if you want toggle to be open by default.', 'js_composer' ),
  76. ),
  77. vc_map_add_css_animation(),
  78. array(
  79. 'type' => 'el_id',
  80. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  81. 'param_name' => 'el_id',
  82. '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>' ),
  83. ),
  84. array(
  85. 'type' => 'textfield',
  86. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  87. 'param_name' => 'el_class',
  88. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  89. ),
  90. ), $cta_custom_heading, array(
  91. array(
  92. 'type' => 'css_editor',
  93. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  94. 'param_name' => 'css',
  95. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  96. ),
  97. ) );
  98. return array(
  99. 'name' => esc_html__( 'FAQ', 'js_composer' ),
  100. 'base' => 'vc_toggle',
  101. 'icon' => 'icon-wpb-toggle-small-expand',
  102. 'category' => esc_html__( 'Content', 'js_composer' ),
  103. 'description' => esc_html__( 'Toggle element for Q&A block', 'js_composer' ),
  104. 'params' => $params,
  105. 'js_view' => 'VcToggleView',
  106. );