vc-masonry-grid.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-basic-grid.php' );
  6. /**
  7. * Class WPBakeryShortCode_Vc_Masonry_Grid
  8. */
  9. class WPBakeryShortCode_Vc_Masonry_Grid extends WPBakeryShortCode_Vc_Basic_Grid {
  10. /**
  11. * @return mixed|string
  12. */
  13. protected function getFileName() {
  14. return 'vc_basic_grid';
  15. }
  16. public function shortcodeScripts() {
  17. parent::shortcodeScripts();
  18. wp_register_script( 'vc_masonry', vc_asset_url( 'lib/bower/masonry/dist/masonry.pkgd.min.js' ), array(), WPB_VC_VERSION, true );
  19. }
  20. public function enqueueScripts() {
  21. wp_enqueue_script( 'vc_masonry' );
  22. parent::enqueueScripts();
  23. }
  24. public function buildGridSettings() {
  25. parent::buildGridSettings();
  26. $this->grid_settings['style'] .= '-masonry';
  27. }
  28. /**
  29. * @param $grid_style
  30. * @param $settings
  31. * @param $content
  32. * @return string
  33. */
  34. protected function contentAllMasonry( $grid_style, $settings, $content ) {
  35. return parent::contentAll( $grid_style, $settings, $content );
  36. }
  37. /**
  38. * @param $grid_style
  39. * @param $settings
  40. * @param $content
  41. * @return string
  42. */
  43. protected function contentLazyMasonry( $grid_style, $settings, $content ) {
  44. return parent::contentLazy( $grid_style, $settings, $content );
  45. }
  46. /**
  47. * @param $grid_style
  48. * @param $settings
  49. * @param $content
  50. * @return string
  51. */
  52. protected function contentLoadMoreMasonry( $grid_style, $settings, $content ) {
  53. return parent::contentLoadMore( $grid_style, $settings, $content );
  54. }
  55. }