vc-gitem-col.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-column.php' );
  6. /**
  7. * Class WPBakeryShortCode_Vc_Gitem_Col
  8. */
  9. class WPBakeryShortCode_Vc_Gitem_Col extends WPBakeryShortCode_Vc_Column {
  10. public $nonDraggableClass = 'vc-non-draggable-column';
  11. /**
  12. * @param $width
  13. * @param $i
  14. * @return string
  15. * @throws \Exception
  16. */
  17. public function mainHtmlBlockParams( $width, $i ) {
  18. $sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? ' wpb_sortable ' : ' ' . $this->nonDraggableClass . ' ' );
  19. return 'data-element_type="' . $this->settings['base'] . '" data-vc-column-width="' . wpb_vc_get_column_width_indent( $width[ $i ] ) . '" class="wpb_vc_column wpb_' . $this->settings['base'] . $sortable . $this->templateWidth() . ' wpb_content_holder"' . $this->customAdminBlockParams();
  20. }
  21. /**
  22. * @return string
  23. */
  24. public function outputEditorControlAlign() {
  25. $alignment = array(
  26. array(
  27. 'name' => 'left',
  28. 'label' => esc_html__( 'Left', 'js_composer' ),
  29. ),
  30. array(
  31. 'name' => 'center',
  32. 'label' => esc_html__( 'Center', 'js_composer' ),
  33. ),
  34. array(
  35. 'name' => 'right',
  36. 'label' => esc_html__( 'Right', 'js_composer' ),
  37. ),
  38. );
  39. $output = '<span class="vc_control vc_control-align"><span class="vc_control-wrap">';
  40. foreach ( $alignment as $data ) {
  41. $attr = esc_attr( $data['name'] );
  42. $output .= sprintf( '<a href="#" data-vc-control-btn="align" data-vc-align="%s" class="vc_control vc_control-align-%s" title="%s"><i class="vc_icon vc_icon-align-%s"></i></a>', esc_attr( $attr ), $attr, esc_html( $data['label'] ), $attr );
  43. }
  44. return $output . '</span></span>';
  45. }
  46. }