vc-toggle.php 815 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. /**
  6. * Class WPBakeryShortCode_Vc_Toggle
  7. */
  8. class WPBakeryShortCode_Vc_Toggle extends WPBakeryShortCode {
  9. /**
  10. * @param $title
  11. * @return string
  12. */
  13. public function outputTitle( $title ) {
  14. return '';
  15. }
  16. /**
  17. * @param $atts
  18. * @return string
  19. * @throws \Exception
  20. */
  21. public function getHeading( $atts ) {
  22. if ( isset( $atts['use_custom_heading'] ) && 'true' === $atts['use_custom_heading'] ) {
  23. $custom_heading = visual_composer()->getShortCode( 'vc_custom_heading' );
  24. $data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_custom_heading', $atts, 'custom_' );
  25. $data['text'] = $atts['title'];
  26. return $custom_heading->render( array_filter( $data ) );
  27. } else {
  28. return '<h4>' . esc_html( $atts['title'] ) . '</h4>';
  29. }
  30. }
  31. }