class-vc-grids-common.php 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once dirname( __FILE__ ) . '/vc-grids-functions.php';
  6. if ( ! class_exists( 'VcGridsCommon' ) ) {
  7. /**
  8. * Class VcGridsCommon
  9. */
  10. abstract class VcGridsCommon {
  11. protected static $basicGrid;
  12. protected static $masonryGrid;
  13. protected static $masonryMediaGrid;
  14. protected static $mediaGrid;
  15. protected static $btn3Params;
  16. protected static $gridColsList;
  17. protected static function initData() {
  18. self::$btn3Params = vc_map_integrate_shortcode( 'vc_btn', 'btn_', esc_html__( 'Load More Button', 'js_composer' ), array(
  19. 'exclude' => array(
  20. 'link',
  21. 'css',
  22. 'i_css',
  23. 'el_class',
  24. 'css_animation',
  25. ),
  26. ), array(
  27. 'element' => 'style',
  28. 'value' => array( 'load-more' ),
  29. ) );
  30. foreach ( self::$btn3Params as $key => $value ) {
  31. if ( 'btn_title' === $value['param_name'] ) {
  32. self::$btn3Params[ $key ]['value'] = esc_html__( 'Load more', 'js_composer' );
  33. } elseif ( 'btn_color' === $value['param_name'] ) {
  34. self::$btn3Params[ $key ]['std'] = 'blue';
  35. } elseif ( 'btn_style' === $value['param_name'] ) {
  36. self::$btn3Params[ $key ]['std'] = 'flat';
  37. }
  38. }
  39. // Grid column list
  40. self::$gridColsList = array(
  41. array(
  42. 'label' => '6',
  43. 'value' => 2,
  44. ),
  45. array(
  46. 'label' => '4',
  47. 'value' => 3,
  48. ),
  49. array(
  50. 'label' => '3',
  51. 'value' => 4,
  52. ),
  53. array(
  54. 'label' => '2',
  55. 'value' => 6,
  56. ),
  57. array(
  58. 'label' => '1',
  59. 'value' => 12,
  60. ),
  61. );
  62. }
  63. /**
  64. * Basic Grid Common Settings
  65. */
  66. public static function getBasicAtts() {
  67. if ( self::$basicGrid ) {
  68. return self::$basicGrid;
  69. }
  70. if ( is_null( self::$btn3Params ) && is_null( self::$gridColsList ) ) {
  71. self::initData();
  72. }
  73. $postTypes = get_post_types( array() );
  74. $postTypesList = array();
  75. $excludedPostTypes = array(
  76. 'revision',
  77. 'nav_menu_item',
  78. 'vc_grid_item',
  79. );
  80. if ( is_array( $postTypes ) && ! empty( $postTypes ) ) {
  81. foreach ( $postTypes as $postType ) {
  82. if ( ! in_array( $postType, $excludedPostTypes, true ) ) {
  83. $label = ucfirst( $postType );
  84. $postTypesList[] = array(
  85. $postType,
  86. $label,
  87. );
  88. }
  89. }
  90. }
  91. $postTypesList[] = array(
  92. 'custom',
  93. esc_html__( 'Custom query', 'js_composer' ),
  94. );
  95. $postTypesList[] = array(
  96. 'ids',
  97. esc_html__( 'List of IDs', 'js_composer' ),
  98. );
  99. $taxonomiesForFilter = array();
  100. if ( 'vc_edit_form' === vc_post_param( 'action' ) ) {
  101. $vcTaxonomiesTypes = vc_taxonomies_types();
  102. if ( is_array( $vcTaxonomiesTypes ) && ! empty( $vcTaxonomiesTypes ) ) {
  103. foreach ( $vcTaxonomiesTypes as $t => $data ) {
  104. if ( 'post_format' !== $t && is_object( $data ) ) {
  105. $taxonomiesForFilter[ $data->labels->name . '(' . $t . ')' ] = $t;
  106. }
  107. }
  108. }
  109. }
  110. self::$basicGrid = array_merge( array(
  111. array(
  112. 'type' => 'dropdown',
  113. 'heading' => esc_html__( 'Data source', 'js_composer' ),
  114. 'param_name' => 'post_type',
  115. 'value' => $postTypesList,
  116. 'save_always' => true,
  117. 'description' => esc_html__( 'Select content type for your grid.', 'js_composer' ),
  118. 'admin_label' => true,
  119. ),
  120. array(
  121. 'type' => 'autocomplete',
  122. 'heading' => esc_html__( 'Include only', 'js_composer' ),
  123. 'param_name' => 'include',
  124. 'description' => esc_html__( 'Add posts, pages, etc. by title.', 'js_composer' ),
  125. 'settings' => array(
  126. 'multiple' => true,
  127. 'sortable' => true,
  128. 'groups' => true,
  129. ),
  130. 'dependency' => array(
  131. 'element' => 'post_type',
  132. 'value' => array( 'ids' ),
  133. ),
  134. ),
  135. // Custom query tab
  136. array(
  137. 'type' => 'textarea_safe',
  138. 'heading' => esc_html__( 'Custom query', 'js_composer' ),
  139. 'param_name' => 'custom_query',
  140. 'description' => sprintf( esc_html__( 'Build custom query according to %sWordPress Codex%s.', 'js_composer' ), '<a href="https://codex.wordpress.org/Function_Reference/query_posts">', '</a>' ),
  141. 'dependency' => array(
  142. 'element' => 'post_type',
  143. 'value' => array( 'custom' ),
  144. ),
  145. ),
  146. array(
  147. 'type' => 'autocomplete',
  148. 'heading' => esc_html__( 'Narrow data source', 'js_composer' ),
  149. 'param_name' => 'taxonomies',
  150. 'settings' => array(
  151. 'multiple' => true,
  152. 'min_length' => 1,
  153. 'groups' => true,
  154. // In UI show results grouped by groups, default false
  155. 'unique_values' => true,
  156. // In UI show results except selected. NB! You should manually check values in backend, default false
  157. 'display_inline' => true,
  158. // In UI show results inline view, default false (each value in own line)
  159. 'delay' => 500,
  160. // delay for search. default 500
  161. 'auto_focus' => true,
  162. // auto focus input, default true
  163. ),
  164. 'param_holder_class' => 'vc_not-for-custom',
  165. 'description' => esc_html__( 'Enter categories, tags or custom taxonomies.', 'js_composer' ),
  166. 'dependency' => array(
  167. 'element' => 'post_type',
  168. 'value_not_equal_to' => array(
  169. 'ids',
  170. 'custom',
  171. ),
  172. 'callback' => 'vcGridTaxonomiesCallBack',
  173. ),
  174. ),
  175. array(
  176. 'type' => 'textfield',
  177. 'heading' => esc_html__( 'Total items', 'js_composer' ),
  178. 'param_name' => 'max_items',
  179. 'value' => 10,
  180. // default value
  181. 'param_holder_class' => 'vc_not-for-custom',
  182. 'description' => esc_html__( 'Set max limit for items in grid or enter -1 to display all (limited to 1000).', 'js_composer' ),
  183. 'dependency' => array(
  184. 'element' => 'post_type',
  185. 'value_not_equal_to' => array(
  186. 'ids',
  187. 'custom',
  188. ),
  189. ),
  190. ),
  191. array(
  192. 'type' => 'dropdown',
  193. 'heading' => esc_html__( 'Display Style', 'js_composer' ),
  194. 'param_name' => 'style',
  195. 'value' => array(
  196. esc_html__( 'Show all', 'js_composer' ) => 'all',
  197. esc_html__( 'Load more button', 'js_composer' ) => 'load-more',
  198. esc_html__( 'Lazy loading', 'js_composer' ) => 'lazy',
  199. esc_html__( 'Pagination', 'js_composer' ) => 'pagination',
  200. ),
  201. 'dependency' => array(
  202. 'element' => 'post_type',
  203. 'value_not_equal_to' => array( 'custom' ),
  204. ),
  205. 'edit_field_class' => 'vc_col-sm-6',
  206. 'description' => esc_html__( 'Select display style for grid.', 'js_composer' ),
  207. ),
  208. array(
  209. 'type' => 'textfield',
  210. 'heading' => esc_html__( 'Items per page', 'js_composer' ),
  211. 'param_name' => 'items_per_page',
  212. 'description' => esc_html__( 'Number of items to show per page.', 'js_composer' ),
  213. 'value' => '10',
  214. 'dependency' => array(
  215. 'element' => 'style',
  216. 'value' => array(
  217. 'lazy',
  218. 'load-more',
  219. 'pagination',
  220. ),
  221. ),
  222. 'edit_field_class' => 'vc_col-sm-6',
  223. ),
  224. array(
  225. 'type' => 'checkbox',
  226. 'heading' => esc_html__( 'Show filter', 'js_composer' ),
  227. 'param_name' => 'show_filter',
  228. 'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
  229. 'description' => esc_html__( 'Append filter to grid.', 'js_composer' ),
  230. ),
  231. array(
  232. 'type' => 'dropdown',
  233. 'heading' => esc_html__( 'Grid elements per row', 'js_composer' ),
  234. 'param_name' => 'element_width',
  235. 'value' => self::$gridColsList,
  236. 'std' => '4',
  237. 'edit_field_class' => 'vc_col-sm-6',
  238. 'description' => esc_html__( 'Select number of single grid elements per row.', 'js_composer' ),
  239. ),
  240. array(
  241. 'type' => 'dropdown',
  242. 'heading' => esc_html__( 'Gap', 'js_composer' ),
  243. 'param_name' => 'gap',
  244. 'value' => array(
  245. '0px' => '0',
  246. '1px' => '1',
  247. '2px' => '2',
  248. '3px' => '3',
  249. '4px' => '4',
  250. '5px' => '5',
  251. '10px' => '10',
  252. '15px' => '15',
  253. '20px' => '20',
  254. '25px' => '25',
  255. '30px' => '30',
  256. '35px' => '35',
  257. ),
  258. 'std' => '30',
  259. 'description' => esc_html__( 'Select gap between grid elements.', 'js_composer' ),
  260. 'edit_field_class' => 'vc_col-sm-6',
  261. ),
  262. // Data settings
  263. array(
  264. 'type' => 'dropdown',
  265. 'heading' => esc_html__( 'Order by', 'js_composer' ),
  266. 'param_name' => 'orderby',
  267. 'value' => array(
  268. esc_html__( 'Date', 'js_composer' ) => 'date',
  269. esc_html__( 'Order by post ID', 'js_composer' ) => 'ID',
  270. esc_html__( 'Author', 'js_composer' ) => 'author',
  271. esc_html__( 'Title', 'js_composer' ) => 'title',
  272. esc_html__( 'Last modified date', 'js_composer' ) => 'modified',
  273. esc_html__( 'Post/page parent ID', 'js_composer' ) => 'parent',
  274. esc_html__( 'Number of comments', 'js_composer' ) => 'comment_count',
  275. esc_html__( 'Menu order/Page Order', 'js_composer' ) => 'menu_order',
  276. esc_html__( 'Meta value', 'js_composer' ) => 'meta_value',
  277. esc_html__( 'Meta value number', 'js_composer' ) => 'meta_value_num',
  278. esc_html__( 'Random order', 'js_composer' ) => 'rand',
  279. ),
  280. 'description' => esc_html__( 'Select order type. If "Meta value" or "Meta value Number" is chosen then meta key is required.', 'js_composer' ),
  281. 'group' => esc_html__( 'Data Settings', 'js_composer' ),
  282. 'param_holder_class' => 'vc_grid-data-type-not-ids',
  283. 'dependency' => array(
  284. 'element' => 'post_type',
  285. 'value_not_equal_to' => array(
  286. 'ids',
  287. 'custom',
  288. ),
  289. ),
  290. ),
  291. array(
  292. 'type' => 'dropdown',
  293. 'heading' => esc_html__( 'Sort order', 'js_composer' ),
  294. 'param_name' => 'order',
  295. 'group' => esc_html__( 'Data Settings', 'js_composer' ),
  296. 'value' => array(
  297. esc_html__( 'Descending', 'js_composer' ) => 'DESC',
  298. esc_html__( 'Ascending', 'js_composer' ) => 'ASC',
  299. ),
  300. 'param_holder_class' => 'vc_grid-data-type-not-ids',
  301. 'description' => esc_html__( 'Select sorting order.', 'js_composer' ),
  302. 'dependency' => array(
  303. 'element' => 'post_type',
  304. 'value_not_equal_to' => array(
  305. 'ids',
  306. 'custom',
  307. ),
  308. ),
  309. ),
  310. array(
  311. 'type' => 'textfield',
  312. 'heading' => esc_html__( 'Meta key', 'js_composer' ),
  313. 'param_name' => 'meta_key',
  314. 'description' => esc_html__( 'Input meta key for grid ordering.', 'js_composer' ),
  315. 'group' => esc_html__( 'Data Settings', 'js_composer' ),
  316. 'param_holder_class' => 'vc_grid-data-type-not-ids',
  317. 'dependency' => array(
  318. 'element' => 'orderby',
  319. 'value' => array(
  320. 'meta_value',
  321. 'meta_value_num',
  322. ),
  323. ),
  324. ),
  325. array(
  326. 'type' => 'textfield',
  327. 'heading' => esc_html__( 'Offset', 'js_composer' ),
  328. 'param_name' => 'offset',
  329. 'description' => esc_html__( 'Number of grid elements to displace or pass over.', 'js_composer' ),
  330. 'group' => esc_html__( 'Data Settings', 'js_composer' ),
  331. 'param_holder_class' => 'vc_grid-data-type-not-ids',
  332. 'dependency' => array(
  333. 'element' => 'post_type',
  334. 'value_not_equal_to' => array(
  335. 'ids',
  336. 'custom',
  337. ),
  338. ),
  339. ),
  340. array(
  341. 'type' => 'autocomplete',
  342. 'heading' => esc_html__( 'Exclude', 'js_composer' ),
  343. 'param_name' => 'exclude',
  344. 'description' => esc_html__( 'Exclude posts, pages, etc. by title.', 'js_composer' ),
  345. 'group' => esc_html__( 'Data Settings', 'js_composer' ),
  346. 'settings' => array(
  347. 'multiple' => true,
  348. ),
  349. 'param_holder_class' => 'vc_grid-data-type-not-ids',
  350. 'dependency' => array(
  351. 'element' => 'post_type',
  352. 'value_not_equal_to' => array(
  353. 'ids',
  354. 'custom',
  355. ),
  356. 'callback' => 'vc_grid_exclude_dependency_callback',
  357. ),
  358. ),
  359. // Filter tab
  360. array(
  361. 'type' => 'dropdown',
  362. 'heading' => esc_html__( 'Filter by', 'js_composer' ),
  363. 'param_name' => 'filter_source',
  364. 'value' => $taxonomiesForFilter,
  365. 'group' => esc_html__( 'Filter', 'js_composer' ),
  366. 'dependency' => array(
  367. 'element' => 'show_filter',
  368. 'value' => array( 'yes' ),
  369. ),
  370. 'save_always' => true,
  371. 'description' => esc_html__( 'Select filter source.', 'js_composer' ),
  372. ),
  373. array(
  374. 'type' => 'autocomplete',
  375. 'heading' => esc_html__( 'Exclude from filter list', 'js_composer' ),
  376. 'param_name' => 'exclude_filter',
  377. 'settings' => array(
  378. 'multiple' => true,
  379. // is multiple values allowed? default false
  380. 'min_length' => 1,
  381. // min length to start search -> default 2
  382. 'groups' => true,
  383. // In UI show results grouped by groups, default false
  384. 'unique_values' => true,
  385. // In UI show results except selected. NB! You should manually check values in backend, default false
  386. 'display_inline' => true,
  387. // In UI show results inline view, default false (each value in own line)
  388. 'delay' => 500,
  389. // delay for search. default 500
  390. 'auto_focus' => true,
  391. // auto focus input, default true
  392. ),
  393. 'description' => esc_html__( 'Enter categories, tags won\'t be shown in the filters list', 'js_composer' ),
  394. 'dependency' => array(
  395. 'element' => 'show_filter',
  396. 'value' => array( 'yes' ),
  397. 'callback' => 'vcGridFilterExcludeCallBack',
  398. ),
  399. 'group' => esc_html__( 'Filter', 'js_composer' ),
  400. ),
  401. array(
  402. 'type' => 'dropdown',
  403. 'heading' => esc_html__( 'Style', 'js_composer' ),
  404. 'param_name' => 'filter_style',
  405. 'value' => array(
  406. esc_html__( 'Rounded', 'js_composer' ) => 'default',
  407. esc_html__( 'Less Rounded', 'js_composer' ) => 'default-less-rounded',
  408. esc_html__( 'Border', 'js_composer' ) => 'bordered',
  409. esc_html__( 'Rounded Border', 'js_composer' ) => 'bordered-rounded',
  410. esc_html__( 'Less Rounded Border', 'js_composer' ) => 'bordered-rounded-less',
  411. esc_html__( 'Filled', 'js_composer' ) => 'filled',
  412. esc_html__( 'Rounded Filled', 'js_composer' ) => 'filled-rounded',
  413. esc_html__( 'Dropdown', 'js_composer' ) => 'dropdown',
  414. ),
  415. 'dependency' => array(
  416. 'element' => 'show_filter',
  417. 'value' => array( 'yes' ),
  418. ),
  419. 'group' => esc_html__( 'Filter', 'js_composer' ),
  420. 'description' => esc_html__( 'Select filter display style.', 'js_composer' ),
  421. ),
  422. array(
  423. 'type' => 'textfield',
  424. 'heading' => esc_html__( 'Default title', 'js_composer' ),
  425. 'param_name' => 'filter_default_title',
  426. 'value' => esc_html__( 'All', 'js_composer' ),
  427. 'description' => esc_html__( 'Enter default title for filter option display (empty: "All").', 'js_composer' ),
  428. 'dependency' => array(
  429. 'element' => 'show_filter',
  430. 'value' => array( 'yes' ),
  431. ),
  432. 'group' => esc_html__( 'Filter', 'js_composer' ),
  433. ),
  434. array(
  435. 'type' => 'dropdown',
  436. 'heading' => esc_html__( 'Alignment', 'js_composer' ),
  437. 'param_name' => 'filter_align',
  438. 'value' => array(
  439. esc_html__( 'Center', 'js_composer' ) => 'center',
  440. esc_html__( 'Left', 'js_composer' ) => 'left',
  441. esc_html__( 'Right', 'js_composer' ) => 'right',
  442. ),
  443. 'dependency' => array(
  444. 'element' => 'show_filter',
  445. 'value' => array( 'yes' ),
  446. ),
  447. 'group' => esc_html__( 'Filter', 'js_composer' ),
  448. 'description' => esc_html__( 'Select filter alignment.', 'js_composer' ),
  449. ),
  450. array(
  451. 'type' => 'dropdown',
  452. 'heading' => esc_html__( 'Color', 'js_composer' ),
  453. 'param_name' => 'filter_color',
  454. 'value' => vc_get_shared( 'colors' ),
  455. 'std' => 'grey',
  456. 'param_holder_class' => 'vc_colored-dropdown',
  457. 'dependency' => array(
  458. 'element' => 'show_filter',
  459. 'value' => array( 'yes' ),
  460. ),
  461. 'group' => esc_html__( 'Filter', 'js_composer' ),
  462. 'description' => esc_html__( 'Select filter color.', 'js_composer' ),
  463. ),
  464. array(
  465. 'type' => 'dropdown',
  466. 'heading' => esc_html__( 'Filter size', 'js_composer' ),
  467. 'param_name' => 'filter_size',
  468. 'value' => vc_get_shared( 'sizes' ),
  469. 'std' => 'md',
  470. 'description' => esc_html__( 'Select filter size.', 'js_composer' ),
  471. 'dependency' => array(
  472. 'element' => 'show_filter',
  473. 'value' => array( 'yes' ),
  474. ),
  475. 'group' => esc_html__( 'Filter', 'js_composer' ),
  476. ),
  477. // moved to the end
  478. // Paging controls
  479. array(
  480. 'type' => 'dropdown',
  481. 'heading' => esc_html__( 'Arrows design', 'js_composer' ),
  482. 'param_name' => 'arrows_design',
  483. 'value' => array(
  484. esc_html__( 'None', 'js_composer' ) => 'none',
  485. esc_html__( 'Simple', 'js_composer' ) => 'vc_arrow-icon-arrow_01_left',
  486. esc_html__( 'Simple Circle Border', 'js_composer' ) => 'vc_arrow-icon-arrow_02_left',
  487. esc_html__( 'Simple Circle', 'js_composer' ) => 'vc_arrow-icon-arrow_03_left',
  488. esc_html__( 'Simple Square', 'js_composer' ) => 'vc_arrow-icon-arrow_09_left',
  489. esc_html__( 'Simple Square Rounded', 'js_composer' ) => 'vc_arrow-icon-arrow_12_left',
  490. esc_html__( 'Simple Rounded', 'js_composer' ) => 'vc_arrow-icon-arrow_11_left',
  491. esc_html__( 'Rounded', 'js_composer' ) => 'vc_arrow-icon-arrow_04_left',
  492. esc_html__( 'Rounded Circle Border', 'js_composer' ) => 'vc_arrow-icon-arrow_05_left',
  493. esc_html__( 'Rounded Circle', 'js_composer' ) => 'vc_arrow-icon-arrow_06_left',
  494. esc_html__( 'Rounded Square', 'js_composer' ) => 'vc_arrow-icon-arrow_10_left',
  495. esc_html__( 'Simple Arrow', 'js_composer' ) => 'vc_arrow-icon-arrow_08_left',
  496. esc_html__( 'Simple Rounded Arrow', 'js_composer' ) => 'vc_arrow-icon-arrow_07_left',
  497. ),
  498. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  499. 'dependency' => array(
  500. 'element' => 'style',
  501. 'value' => array( 'pagination' ),
  502. ),
  503. 'description' => esc_html__( 'Select design for arrows.', 'js_composer' ),
  504. ),
  505. array(
  506. 'type' => 'dropdown',
  507. 'heading' => esc_html__( 'Arrows position', 'js_composer' ),
  508. 'param_name' => 'arrows_position',
  509. 'value' => array(
  510. esc_html__( 'Inside Wrapper', 'js_composer' ) => 'inside',
  511. esc_html__( 'Outside Wrapper', 'js_composer' ) => 'outside',
  512. ),
  513. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  514. 'dependency' => array(
  515. 'element' => 'arrows_design',
  516. 'value_not_equal_to' => array( 'none' ),
  517. // New dependency
  518. ),
  519. 'description' => esc_html__( 'Arrows will be displayed inside or outside grid.', 'js_composer' ),
  520. ),
  521. array(
  522. 'type' => 'dropdown',
  523. 'heading' => esc_html__( 'Arrows color', 'js_composer' ),
  524. 'param_name' => 'arrows_color',
  525. 'value' => vc_get_shared( 'colors' ),
  526. 'param_holder_class' => 'vc_colored-dropdown',
  527. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  528. 'dependency' => array(
  529. 'element' => 'arrows_design',
  530. 'value_not_equal_to' => array( 'none' ),
  531. // New dependency
  532. ),
  533. 'description' => esc_html__( 'Select color for arrows.', 'js_composer' ),
  534. ),
  535. array(
  536. 'type' => 'dropdown',
  537. 'heading' => esc_html__( 'Pagination style', 'js_composer' ),
  538. 'param_name' => 'paging_design',
  539. 'value' => array(
  540. esc_html__( 'None', 'js_composer' ) => 'none',
  541. esc_html__( 'Square Dots', 'js_composer' ) => 'square_dots',
  542. esc_html__( 'Radio Dots', 'js_composer' ) => 'radio_dots',
  543. esc_html__( 'Point Dots', 'js_composer' ) => 'point_dots',
  544. esc_html__( 'Fill Square Dots', 'js_composer' ) => 'fill_square_dots',
  545. esc_html__( 'Rounded Fill Square Dots', 'js_composer' ) => 'round_fill_square_dots',
  546. esc_html__( 'Pagination Default', 'js_composer' ) => 'pagination_default',
  547. esc_html__( 'Outline Default Dark', 'js_composer' ) => 'pagination_default_dark',
  548. esc_html__( 'Outline Default Light', 'js_composer' ) => 'pagination_default_light',
  549. esc_html__( 'Pagination Rounded', 'js_composer' ) => 'pagination_rounded',
  550. esc_html__( 'Outline Rounded Dark', 'js_composer' ) => 'pagination_rounded_dark',
  551. esc_html__( 'Outline Rounded Light', 'js_composer' ) => 'pagination_rounded_light',
  552. esc_html__( 'Pagination Square', 'js_composer' ) => 'pagination_square',
  553. esc_html__( 'Outline Square Dark', 'js_composer' ) => 'pagination_square_dark',
  554. esc_html__( 'Outline Square Light', 'js_composer' ) => 'pagination_square_light',
  555. esc_html__( 'Pagination Rounded Square', 'js_composer' ) => 'pagination_rounded_square',
  556. esc_html__( 'Outline Rounded Square Dark', 'js_composer' ) => 'pagination_rounded_square_dark',
  557. esc_html__( 'Outline Rounded Square Light', 'js_composer' ) => 'pagination_rounded_square_light',
  558. esc_html__( 'Stripes Dark', 'js_composer' ) => 'pagination_stripes_dark',
  559. esc_html__( 'Stripes Light', 'js_composer' ) => 'pagination_stripes_light',
  560. ),
  561. 'std' => 'radio_dots',
  562. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  563. 'dependency' => array(
  564. 'element' => 'style',
  565. 'value' => array( 'pagination' ),
  566. ),
  567. 'description' => esc_html__( 'Select pagination style.', 'js_composer' ),
  568. ),
  569. array(
  570. 'type' => 'dropdown',
  571. 'heading' => esc_html__( 'Pagination color', 'js_composer' ),
  572. 'param_name' => 'paging_color',
  573. 'value' => vc_get_shared( 'colors' ),
  574. 'std' => 'grey',
  575. 'param_holder_class' => 'vc_colored-dropdown',
  576. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  577. 'dependency' => array(
  578. 'element' => 'paging_design',
  579. 'value_not_equal_to' => array( 'none' ),
  580. // New dependency
  581. ),
  582. 'description' => esc_html__( 'Select pagination color.', 'js_composer' ),
  583. ),
  584. array(
  585. 'type' => 'checkbox',
  586. 'heading' => esc_html__( 'Loop pages?', 'js_composer' ),
  587. 'param_name' => 'loop',
  588. 'description' => esc_html__( 'Allow items to be repeated in infinite loop (carousel).', 'js_composer' ),
  589. 'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
  590. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  591. 'dependency' => array(
  592. 'element' => 'style',
  593. 'value' => array( 'pagination' ),
  594. ),
  595. ),
  596. array(
  597. 'type' => 'textfield',
  598. 'heading' => esc_html__( 'Autoplay delay', 'js_composer' ),
  599. 'param_name' => 'autoplay',
  600. 'value' => '-1',
  601. 'description' => esc_html__( 'Enter value in seconds. Set -1 to disable autoplay.', 'js_composer' ),
  602. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  603. 'dependency' => array(
  604. 'element' => 'style',
  605. 'value' => array( 'pagination' ),
  606. ),
  607. ),
  608. array(
  609. 'type' => 'animation_style',
  610. 'heading' => esc_html__( 'Animation In', 'js_composer' ),
  611. 'param_name' => 'paging_animation_in',
  612. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  613. 'settings' => array(
  614. 'type' => array(
  615. 'in',
  616. 'other',
  617. ),
  618. ),
  619. 'dependency' => array(
  620. 'element' => 'style',
  621. 'value' => array( 'pagination' ),
  622. ),
  623. 'description' => esc_html__( 'Select "animation in" for page transition.', 'js_composer' ),
  624. ),
  625. array(
  626. 'type' => 'animation_style',
  627. 'heading' => esc_html__( 'Animation Out', 'js_composer' ),
  628. 'param_name' => 'paging_animation_out',
  629. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  630. 'settings' => array(
  631. 'type' => array( 'out' ),
  632. ),
  633. 'dependency' => array(
  634. 'element' => 'style',
  635. 'value' => array( 'pagination' ),
  636. ),
  637. 'description' => esc_html__( 'Select "animation out" for page transition.', 'js_composer' ),
  638. ),
  639. array(
  640. 'type' => 'vc_grid_item',
  641. 'heading' => esc_html__( 'Grid element template', 'js_composer' ),
  642. 'param_name' => 'item',
  643. 'description' => sprintf( esc_html__( '%sCreate new%s template or %smodify selected%s. Predefined templates will be cloned.', 'js_composer' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=vc_grid_item' ) ) . '" target="_blank">', '</a>', '<a href="#" target="_blank" data-vc-grid-item="edit_link">', '</a>' ),
  644. 'group' => esc_html__( 'Item Design', 'js_composer' ),
  645. 'value' => 'none',
  646. ),
  647. array(
  648. 'type' => 'vc_grid_id',
  649. 'param_name' => 'grid_id',
  650. ),
  651. array(
  652. 'type' => 'animation_style',
  653. 'heading' => esc_html__( 'Initial loading animation', 'js_composer' ),
  654. 'param_name' => 'initial_loading_animation',
  655. 'value' => 'fadeIn',
  656. 'settings' => array(
  657. 'type' => array(
  658. 'in',
  659. 'other',
  660. ),
  661. ),
  662. 'description' => esc_html__( 'Select initial loading animation for grid element.', 'js_composer' ),
  663. ),
  664. array(
  665. 'type' => 'el_id',
  666. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  667. 'param_name' => 'el_id',
  668. '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>' ),
  669. ),
  670. array(
  671. 'type' => 'textfield',
  672. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  673. 'param_name' => 'el_class',
  674. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  675. ),
  676. array(
  677. 'type' => 'css_editor',
  678. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  679. 'param_name' => 'css',
  680. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  681. ),
  682. // Load more btn
  683. array(
  684. 'type' => 'hidden',
  685. 'heading' => esc_html__( 'Button style', 'js_composer' ),
  686. 'param_name' => 'button_style',
  687. 'value' => '',
  688. 'param_holder_class' => 'vc_colored-dropdown',
  689. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  690. 'dependency' => array(
  691. 'element' => 'style',
  692. 'value' => array( 'load-more' ),
  693. ),
  694. 'description' => esc_html__( 'Select button style.', 'js_composer' ),
  695. ),
  696. array(
  697. 'type' => 'hidden',
  698. 'heading' => esc_html__( 'Button color', 'js_composer' ),
  699. 'param_name' => 'button_color',
  700. 'value' => '',
  701. 'param_holder_class' => 'vc_colored-dropdown',
  702. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  703. 'dependency' => array(
  704. 'element' => 'style',
  705. 'value' => array( 'load-more' ),
  706. ),
  707. 'description' => esc_html__( 'Select button color.', 'js_composer' ),
  708. ),
  709. array(
  710. 'type' => 'hidden',
  711. 'heading' => esc_html__( 'Button size', 'js_composer' ),
  712. 'param_name' => 'button_size',
  713. 'value' => '',
  714. 'description' => esc_html__( 'Select button size.', 'js_composer' ),
  715. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  716. 'dependency' => array(
  717. 'element' => 'style',
  718. 'value' => array( 'load-more' ),
  719. ),
  720. ),
  721. ), self::$btn3Params );
  722. self::$basicGrid = array_merge( self::$basicGrid );
  723. return self::$basicGrid;
  724. }
  725. /**
  726. * Media grid common settings
  727. */
  728. public static function getMediaCommonAtts() {
  729. if ( self::$mediaGrid ) {
  730. return self::$mediaGrid;
  731. }
  732. if ( is_null( self::$btn3Params ) && is_null( self::$gridColsList ) ) {
  733. self::initData();
  734. }
  735. self::$mediaGrid = array_merge( array(
  736. array(
  737. 'type' => 'attach_images',
  738. 'heading' => esc_html__( 'Images', 'js_composer' ),
  739. 'param_name' => 'include',
  740. 'description' => esc_html__( 'Select images from media library.', 'js_composer' ),
  741. ),
  742. array(
  743. 'type' => 'dropdown',
  744. 'heading' => esc_html__( 'Display Style', 'js_composer' ),
  745. 'param_name' => 'style',
  746. 'value' => array(
  747. esc_html__( 'Show all', 'js_composer' ) => 'all',
  748. esc_html__( 'Load more button', 'js_composer' ) => 'load-more',
  749. esc_html__( 'Lazy loading', 'js_composer' ) => 'lazy',
  750. esc_html__( 'Pagination', 'js_composer' ) => 'pagination',
  751. ),
  752. 'dependency' => array(
  753. 'element' => 'post_type',
  754. 'value_not_equal_to' => array( 'custom' ),
  755. ),
  756. 'edit_field_class' => 'vc_col-sm-6',
  757. 'description' => esc_html__( 'Select display style for grid.', 'js_composer' ),
  758. ),
  759. array(
  760. 'type' => 'textfield',
  761. 'heading' => esc_html__( 'Items per page', 'js_composer' ),
  762. 'param_name' => 'items_per_page',
  763. 'description' => esc_html__( 'Number of items to show per page.', 'js_composer' ),
  764. 'value' => '10',
  765. 'dependency' => array(
  766. 'element' => 'style',
  767. 'value' => array(
  768. 'lazy',
  769. 'load-more',
  770. 'pagination',
  771. ),
  772. ),
  773. 'edit_field_class' => 'vc_col-sm-6',
  774. ),
  775. array(
  776. 'type' => 'dropdown',
  777. 'heading' => esc_html__( 'Grid elements per row', 'js_composer' ),
  778. 'param_name' => 'element_width',
  779. 'value' => self::$gridColsList,
  780. 'std' => '4',
  781. 'edit_field_class' => 'vc_col-sm-6',
  782. 'description' => esc_html__( 'Select number of single grid elements per row.', 'js_composer' ),
  783. ),
  784. array(
  785. 'type' => 'dropdown',
  786. 'heading' => esc_html__( 'Gap', 'js_composer' ),
  787. 'param_name' => 'gap',
  788. 'value' => array(
  789. '0px' => '0',
  790. '1px' => '1',
  791. '2px' => '2',
  792. '3px' => '3',
  793. '4px' => '4',
  794. '5px' => '5',
  795. '10px' => '10',
  796. '15px' => '15',
  797. '20px' => '20',
  798. '25px' => '25',
  799. '30px' => '30',
  800. '35px' => '35',
  801. ),
  802. 'std' => '5',
  803. 'description' => esc_html__( 'Select gap between grid elements.', 'js_composer' ),
  804. 'edit_field_class' => 'vc_col-sm-6',
  805. ),
  806. array(
  807. 'type' => 'hidden',
  808. 'heading' => esc_html__( 'Button style', 'js_composer' ),
  809. 'param_name' => 'button_style',
  810. 'value' => '',
  811. 'param_holder_class' => 'vc_colored-dropdown',
  812. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  813. 'dependency' => array(
  814. 'element' => 'style',
  815. 'value' => array( 'load-more' ),
  816. ),
  817. 'description' => esc_html__( 'Select button style.', 'js_composer' ),
  818. ),
  819. array(
  820. 'type' => 'hidden',
  821. 'heading' => esc_html__( 'Button color', 'js_composer' ),
  822. 'param_name' => 'button_color',
  823. 'value' => '',
  824. 'param_holder_class' => 'vc_colored-dropdown',
  825. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  826. 'dependency' => array(
  827. 'element' => 'style',
  828. 'value' => array( 'load-more' ),
  829. ),
  830. 'description' => esc_html__( 'Select button color.', 'js_composer' ),
  831. ),
  832. array(
  833. 'type' => 'hidden',
  834. 'heading' => esc_html__( 'Button size', 'js_composer' ),
  835. 'param_name' => 'button_size',
  836. 'value' => '',
  837. 'description' => esc_html__( 'Select button size.', 'js_composer' ),
  838. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  839. 'dependency' => array(
  840. 'element' => 'style',
  841. 'value' => array( 'load-more' ),
  842. ),
  843. ),
  844. array(
  845. 'type' => 'dropdown',
  846. 'heading' => esc_html__( 'Arrows design', 'js_composer' ),
  847. 'param_name' => 'arrows_design',
  848. 'value' => array(
  849. esc_html__( 'None', 'js_composer' ) => 'none',
  850. esc_html__( 'Simple', 'js_composer' ) => 'vc_arrow-icon-arrow_01_left',
  851. esc_html__( 'Simple Circle Border', 'js_composer' ) => 'vc_arrow-icon-arrow_02_left',
  852. esc_html__( 'Simple Circle', 'js_composer' ) => 'vc_arrow-icon-arrow_03_left',
  853. esc_html__( 'Simple Square', 'js_composer' ) => 'vc_arrow-icon-arrow_09_left',
  854. esc_html__( 'Simple Square Rounded', 'js_composer' ) => 'vc_arrow-icon-arrow_12_left',
  855. esc_html__( 'Simple Rounded', 'js_composer' ) => 'vc_arrow-icon-arrow_11_left',
  856. esc_html__( 'Rounded', 'js_composer' ) => 'vc_arrow-icon-arrow_04_left',
  857. esc_html__( 'Rounded Circle Border', 'js_composer' ) => 'vc_arrow-icon-arrow_05_left',
  858. esc_html__( 'Rounded Circle', 'js_composer' ) => 'vc_arrow-icon-arrow_06_left',
  859. esc_html__( 'Rounded Square', 'js_composer' ) => 'vc_arrow-icon-arrow_10_left',
  860. esc_html__( 'Simple Arrow', 'js_composer' ) => 'vc_arrow-icon-arrow_08_left',
  861. esc_html__( 'Simple Rounded Arrow', 'js_composer' ) => 'vc_arrow-icon-arrow_07_left',
  862. ),
  863. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  864. 'dependency' => array(
  865. 'element' => 'style',
  866. 'value' => array( 'pagination' ),
  867. ),
  868. 'description' => esc_html__( 'Select design for arrows.', 'js_composer' ),
  869. ),
  870. array(
  871. 'type' => 'dropdown',
  872. 'heading' => esc_html__( 'Arrows position', 'js_composer' ),
  873. 'param_name' => 'arrows_position',
  874. 'value' => array(
  875. esc_html__( 'Inside Wrapper', 'js_composer' ) => 'inside',
  876. esc_html__( 'Outside Wrapper', 'js_composer' ) => 'outside',
  877. ),
  878. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  879. 'dependency' => array(
  880. 'element' => 'arrows_design',
  881. 'value_not_equal_to' => array( 'none' ),
  882. // New dependency
  883. ),
  884. 'description' => esc_html__( 'Arrows will be displayed inside or outside grid.', 'js_composer' ),
  885. ),
  886. array(
  887. 'type' => 'dropdown',
  888. 'heading' => esc_html__( 'Arrows color', 'js_composer' ),
  889. 'param_name' => 'arrows_color',
  890. 'value' => vc_get_shared( 'colors' ),
  891. 'param_holder_class' => 'vc_colored-dropdown',
  892. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  893. 'dependency' => array(
  894. 'element' => 'arrows_design',
  895. 'value_not_equal_to' => array( 'none' ),
  896. // New dependency
  897. ),
  898. 'description' => esc_html__( 'Select color for arrows.', 'js_composer' ),
  899. ),
  900. array(
  901. 'type' => 'dropdown',
  902. 'heading' => esc_html__( 'Pagination style', 'js_composer' ),
  903. 'param_name' => 'paging_design',
  904. 'value' => array(
  905. esc_html__( 'None', 'js_composer' ) => 'none',
  906. esc_html__( 'Square Dots', 'js_composer' ) => 'square_dots',
  907. esc_html__( 'Radio Dots', 'js_composer' ) => 'radio_dots',
  908. esc_html__( 'Point Dots', 'js_composer' ) => 'point_dots',
  909. esc_html__( 'Fill Square Dots', 'js_composer' ) => 'fill_square_dots',
  910. esc_html__( 'Rounded Fill Square Dots', 'js_composer' ) => 'round_fill_square_dots',
  911. esc_html__( 'Pagination Default', 'js_composer' ) => 'pagination_default',
  912. esc_html__( 'Outline Default Dark', 'js_composer' ) => 'pagination_default_dark',
  913. esc_html__( 'Outline Default Light', 'js_composer' ) => 'pagination_default_light',
  914. esc_html__( 'Pagination Rounded', 'js_composer' ) => 'pagination_rounded',
  915. esc_html__( 'Outline Rounded Dark', 'js_composer' ) => 'pagination_rounded_dark',
  916. esc_html__( 'Outline Rounded Light', 'js_composer' ) => 'pagination_rounded_light',
  917. esc_html__( 'Pagination Square', 'js_composer' ) => 'pagination_square',
  918. esc_html__( 'Outline Square Dark', 'js_composer' ) => 'pagination_square_dark',
  919. esc_html__( 'Outline Square Light', 'js_composer' ) => 'pagination_square_light',
  920. esc_html__( 'Pagination Rounded Square', 'js_composer' ) => 'pagination_rounded_square',
  921. esc_html__( 'Outline Rounded Square Dark', 'js_composer' ) => 'pagination_rounded_square_dark',
  922. esc_html__( 'Outline Rounded Square Light', 'js_composer' ) => 'pagination_rounded_square_light',
  923. esc_html__( 'Stripes Dark', 'js_composer' ) => 'pagination_stripes_dark',
  924. esc_html__( 'Stripes Light', 'js_composer' ) => 'pagination_stripes_light',
  925. ),
  926. 'std' => 'radio_dots',
  927. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  928. 'dependency' => array(
  929. 'element' => 'style',
  930. 'value' => array( 'pagination' ),
  931. ),
  932. 'description' => esc_html__( 'Select pagination style.', 'js_composer' ),
  933. ),
  934. array(
  935. 'type' => 'dropdown',
  936. 'heading' => esc_html__( 'Pagination color', 'js_composer' ),
  937. 'param_name' => 'paging_color',
  938. 'value' => vc_get_shared( 'colors' ),
  939. 'std' => 'grey',
  940. 'param_holder_class' => 'vc_colored-dropdown',
  941. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  942. 'dependency' => array(
  943. 'element' => 'paging_design',
  944. 'value_not_equal_to' => array( 'none' ),
  945. // New dependency
  946. ),
  947. 'description' => esc_html__( 'Select pagination color.', 'js_composer' ),
  948. ),
  949. array(
  950. 'type' => 'checkbox',
  951. 'heading' => esc_html__( 'Loop pages?', 'js_composer' ),
  952. 'param_name' => 'loop',
  953. 'description' => esc_html__( 'Allow items to be repeated in infinite loop (carousel).', 'js_composer' ),
  954. 'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
  955. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  956. 'dependency' => array(
  957. 'element' => 'style',
  958. 'value' => array( 'pagination' ),
  959. ),
  960. ),
  961. array(
  962. 'type' => 'textfield',
  963. 'heading' => esc_html__( 'Autoplay delay', 'js_composer' ),
  964. 'param_name' => 'autoplay',
  965. 'value' => '-1',
  966. 'description' => esc_html__( 'Enter value in seconds. Set -1 to disable autoplay.', 'js_composer' ),
  967. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  968. 'dependency' => array(
  969. 'element' => 'style',
  970. 'value' => array( 'pagination' ),
  971. ),
  972. ),
  973. array(
  974. 'type' => 'animation_style',
  975. 'heading' => esc_html__( 'Animation In', 'js_composer' ),
  976. 'param_name' => 'paging_animation_in',
  977. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  978. 'settings' => array(
  979. 'type' => array(
  980. 'in',
  981. 'other',
  982. ),
  983. ),
  984. 'dependency' => array(
  985. 'element' => 'style',
  986. 'value' => array( 'pagination' ),
  987. ),
  988. 'description' => esc_html__( 'Select "animation in" for page transition.', 'js_composer' ),
  989. ),
  990. array(
  991. 'type' => 'animation_style',
  992. 'heading' => esc_html__( 'Animation Out', 'js_composer' ),
  993. 'param_name' => 'paging_animation_out',
  994. 'group' => esc_html__( 'Pagination', 'js_composer' ),
  995. 'settings' => array(
  996. 'type' => array( 'out' ),
  997. ),
  998. 'dependency' => array(
  999. 'element' => 'style',
  1000. 'value' => array( 'pagination' ),
  1001. ),
  1002. 'description' => esc_html__( 'Select "animation out" for page transition.', 'js_composer' ),
  1003. ),
  1004. array(
  1005. 'type' => 'vc_grid_item',
  1006. 'heading' => esc_html__( 'Grid element template', 'js_composer' ),
  1007. 'param_name' => 'item',
  1008. 'description' => sprintf( esc_html__( '%sCreate new%s template or %smodify selected%s. Predefined templates will be cloned.', 'js_composer' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=vc_grid_item' ) ) . '" target="_blank">', '</a>', '<a href="#" target="_blank" data-vc-grid-item="edit_link">', '</a>' ),
  1009. 'group' => esc_html__( 'Item Design', 'js_composer' ),
  1010. 'value' => 'mediaGrid_Default',
  1011. ),
  1012. array(
  1013. 'type' => 'vc_grid_id',
  1014. 'param_name' => 'grid_id',
  1015. ),
  1016. array(
  1017. 'type' => 'el_id',
  1018. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  1019. 'param_name' => 'el_id',
  1020. '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>' ),
  1021. ),
  1022. array(
  1023. 'type' => 'textfield',
  1024. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  1025. 'param_name' => 'el_class',
  1026. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  1027. ),
  1028. array(
  1029. 'type' => 'css_editor',
  1030. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  1031. 'param_name' => 'css',
  1032. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  1033. ),
  1034. ), self::$btn3Params, array(
  1035. // Load more btn bc
  1036. array(
  1037. 'type' => 'hidden',
  1038. 'heading' => esc_html__( 'Button style', 'js_composer' ),
  1039. 'param_name' => 'button_style',
  1040. 'value' => '',
  1041. 'param_holder_class' => 'vc_colored-dropdown',
  1042. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  1043. 'dependency' => array(
  1044. 'element' => 'style',
  1045. 'value' => array( 'load-more' ),
  1046. ),
  1047. 'description' => esc_html__( 'Select button style.', 'js_composer' ),
  1048. ),
  1049. array(
  1050. 'type' => 'hidden',
  1051. 'heading' => esc_html__( 'Button color', 'js_composer' ),
  1052. 'param_name' => 'button_color',
  1053. 'value' => '',
  1054. 'param_holder_class' => 'vc_colored-dropdown',
  1055. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  1056. 'dependency' => array(
  1057. 'element' => 'style',
  1058. 'value' => array( 'load-more' ),
  1059. ),
  1060. 'description' => esc_html__( 'Select button color.', 'js_composer' ),
  1061. ),
  1062. array(
  1063. 'type' => 'hidden',
  1064. 'heading' => esc_html__( 'Button size', 'js_composer' ),
  1065. 'param_name' => 'button_size',
  1066. 'value' => '',
  1067. 'description' => esc_html__( 'Select button size.', 'js_composer' ),
  1068. 'group' => esc_html__( 'Load More Button', 'js_composer' ),
  1069. 'dependency' => array(
  1070. 'element' => 'style',
  1071. 'value' => array( 'load-more' ),
  1072. ),
  1073. ),
  1074. array(
  1075. 'type' => 'animation_style',
  1076. 'heading' => esc_html__( 'Initial loading animation', 'js_composer' ),
  1077. 'param_name' => 'initial_loading_animation',
  1078. 'value' => 'fadeIn',
  1079. 'settings' => array(
  1080. 'type' => array(
  1081. 'in',
  1082. 'other',
  1083. ),
  1084. ),
  1085. 'description' => esc_html__( 'Select initial loading animation for grid element.', 'js_composer' ),
  1086. ),
  1087. ) );
  1088. self::$mediaGrid = array_merge( self::$mediaGrid );
  1089. return self::$mediaGrid;
  1090. }
  1091. public static function getMasonryCommonAtts() {
  1092. if ( self::$masonryGrid ) {
  1093. return self::$masonryGrid;
  1094. }
  1095. $gridParams = self::getBasicAtts();
  1096. self::$masonryGrid = $gridParams;
  1097. $style = self::arraySearch( self::$masonryGrid, 'param_name', 'style' );
  1098. unset( self::$masonryGrid[ $style ]['value'][ esc_html__( 'Pagination', 'js_composer' ) ] );
  1099. $animation = self::arraySearch( self::$masonryGrid, 'param_name', 'initial_loading_animation' );
  1100. $masonryAnimation = array(
  1101. 'type' => 'dropdown',
  1102. 'heading' => esc_html__( 'Initial loading animation', 'js_composer' ),
  1103. 'param_name' => 'initial_loading_animation',
  1104. 'value' => array(
  1105. esc_html__( 'None', 'js_composer' ) => 'none',
  1106. esc_html__( 'Default', 'js_composer' ) => 'zoomIn',
  1107. esc_html__( 'Fade In', 'js_composer' ) => 'fadeIn',
  1108. ),
  1109. 'std' => 'zoomIn',
  1110. 'description' => esc_html__( 'Select initial loading animation for grid element.', 'js_composer' ),
  1111. );
  1112. self::$masonryGrid[ $animation ] = $masonryAnimation;
  1113. $key = self::arraySearch( self::$masonryGrid, 'group', esc_html__( 'Pagination', 'js_composer' ) );
  1114. while ( $key ) {
  1115. unset( self::$masonryGrid[ $key ] );
  1116. $key = self::arraySearch( self::$masonryGrid, 'group', esc_html__( 'Pagination', 'js_composer' ) );
  1117. }
  1118. $vcGridItem = self::arraySearch( self::$masonryGrid, 'param_name', 'item' );
  1119. self::$masonryGrid[ $vcGridItem ]['value'] = 'masonryGrid_Default';
  1120. self::$masonryGrid = array_merge( self::$masonryGrid );
  1121. return array_merge( self::$masonryGrid );
  1122. }
  1123. public static function getMasonryMediaCommonAtts() {
  1124. if ( self::$masonryMediaGrid ) {
  1125. return self::$masonryMediaGrid;
  1126. }
  1127. $mediaGridParams = self::getMediaCommonAtts();
  1128. self::$masonryMediaGrid = $mediaGridParams;
  1129. $key = self::arraySearch( self::$masonryMediaGrid, 'group', esc_html__( 'Pagination', 'js_composer' ) );
  1130. while ( $key ) {
  1131. unset( self::$masonryMediaGrid[ $key ] );
  1132. $key = self::arraySearch( self::$masonryMediaGrid, 'group', esc_html__( 'Pagination', 'js_composer' ) );
  1133. }
  1134. $vcGridItem = self::arraySearch( self::$masonryMediaGrid, 'param_name', 'item' );
  1135. self::$masonryMediaGrid[ $vcGridItem ]['value'] = 'masonryMedia_Default';
  1136. $style = self::arraySearch( self::$masonryMediaGrid, 'param_name', 'style' );
  1137. unset( self::$masonryMediaGrid[ $style ]['value'][ esc_html__( 'Pagination', 'js_composer' ) ] );
  1138. $animation = self::arraySearch( self::$masonryMediaGrid, 'param_name', 'initial_loading_animation' );
  1139. $masonryAnimation = array(
  1140. 'type' => 'dropdown',
  1141. 'heading' => esc_html__( 'Initial loading animation', 'js_composer' ),
  1142. 'param_name' => 'initial_loading_animation',
  1143. 'value' => array(
  1144. esc_html__( 'None', 'js_composer' ) => 'none',
  1145. esc_html__( 'Default', 'js_composer' ) => 'zoomIn',
  1146. esc_html__( 'Fade In', 'js_composer' ) => 'fadeIn',
  1147. ),
  1148. 'std' => 'zoomIn',
  1149. 'settings' => array(
  1150. 'type' => array(
  1151. 'in',
  1152. 'other',
  1153. ),
  1154. ),
  1155. 'description' => esc_html__( 'Select initial loading animation for grid element.', 'js_composer' ),
  1156. );
  1157. self::$masonryMediaGrid[ $animation ] = $masonryAnimation;
  1158. self::$masonryMediaGrid = array_merge( self::$masonryMediaGrid );
  1159. return array_merge( self::$masonryMediaGrid );
  1160. }
  1161. /**
  1162. * Function to search array
  1163. */
  1164. public static function arraySearch( $array, $column, $value ) {
  1165. if ( ! is_array( $array ) ) {
  1166. return false;
  1167. }
  1168. foreach ( $array as $key => $innerArray ) {
  1169. $exists = isset( $innerArray[ $column ] ) && $innerArray[ $column ] === $value;
  1170. if ( $exists ) {
  1171. return $key;
  1172. }
  1173. }
  1174. return false;
  1175. }
  1176. }
  1177. }