Advertisement
Guest User

Untitled

a guest
Jan 21st, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 68.95 KB | None | 0 0
  1. <?php
  2. /**
  3. * Icon Grid Shortcode
  4. *
  5. * @author tinabillinger
  6. * @since 4.5
  7. * @deprecated 5.1.2 kept for sites that need the old styling and function
  8. *
  9. * Creates an icon grid with toolips or flip content
  10. */
  11. if( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
  12.  
  13. if( ! class_exists( 'avia_sc_icongrid', false ) )
  14. {
  15. class avia_sc_icongrid extends aviaShortcodeTemplate
  16. {
  17. /**
  18. * @since 4.8.8
  19. * @var array
  20. */
  21. protected $in_sc_exec;
  22.  
  23. /**
  24. * @since 4.8.8
  25. * @var int
  26. */
  27. protected $numrow;
  28.  
  29. /**
  30. * @since 4.8.8
  31. * @var int
  32. */
  33. protected $row_count;
  34.  
  35. /**
  36. * @since 4.8.8
  37. * @var int
  38. */
  39. protected $item_count;
  40.  
  41. /**
  42. * @since 4.8.8
  43. * @var int
  44. */
  45. protected $row_item;
  46.  
  47. /**
  48. *
  49. * @since 4.5.1
  50. * @param AviaBuilder $builder
  51. */
  52. public function __construct( $builder )
  53. {
  54. parent::__construct( $builder );
  55.  
  56. $this->in_sc_exec = false;
  57. $this->numrow = 0;
  58. $this->row_count = 1;
  59. $this->item_count = 0;
  60. $this->row_item = 0;
  61. }
  62.  
  63. /**
  64. * @since 4.5.1
  65. */
  66. public function __destruct()
  67. {
  68. parent::__destruct();
  69. }
  70.  
  71. /**
  72. * Create the config array for the shortcode button
  73. */
  74. protected function shortcode_insert_button()
  75. {
  76. $this->config['version'] = '1.0';
  77. $this->config['self_closing'] = 'no';
  78. $this->config['base_element'] = 'yes';
  79.  
  80. $this->config['name'] = __( 'Icon Grid', 'avia_framework' );
  81. $this->config['tab'] = __( 'Content Elements', 'avia_framework' );
  82. $this->config['icon'] = AviaBuilder::$path['imagesURL'] . 'sc-icongrid.png';
  83. $this->config['order'] = 90;
  84. $this->config['target'] = 'avia-target-insert';
  85. $this->config['shortcode'] = 'av_icongrid';
  86. $this->config['shortcode_nested'] = array( 'av_icongrid_item' );
  87. $this->config['tooltip'] = __( 'Creates an icon grid with toolips or flip content', 'avia_framework' );
  88. $this->config['preview'] = false;
  89. $this->config['disabling_allowed'] = true;
  90. $this->config['id_name'] = 'id';
  91. $this->config['id_show'] = 'yes';
  92. $this->config['alb_desc_id'] = 'alb_description';
  93. $this->config['name_item'] = __( 'Icon Grid Item', 'avia_framework' );
  94. $this->config['tooltip_item'] = __( 'An Icon Grid Element Item', 'avia_framework' );
  95. }
  96.  
  97. protected function extra_assets()
  98. {
  99. wp_enqueue_style( 'avia-module-icon', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/icon/icon.css' , array( 'avia-layout' ), false );
  100. wp_enqueue_style( 'avia-module-icongrid', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/icongrid/v50/icongrid.css', array( 'avia-layout' ), false );
  101.  
  102. wp_enqueue_script( 'avia-module-icongrid', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/icongrid/v50/icongrid.js', array( 'avia-shortcodes' ), false, true );
  103. }
  104.  
  105. /**
  106. * Popup Elements
  107. *
  108. * If this function is defined in a child class the element automatically gets an edit button, that, when pressed
  109. * opens a modal window that allows to edit the element properties
  110. *
  111. * @return void
  112. */
  113. protected function popup_elements()
  114. {
  115. $this->elements = array(
  116.  
  117. array(
  118. 'type' => 'tab_container',
  119. 'nodescription' => true
  120. ),
  121.  
  122. array(
  123. 'type' => 'tab',
  124. 'name' => __( 'Content', 'avia_framework' ),
  125. 'nodescription' => true
  126. ),
  127.  
  128. array(
  129. 'type' => 'template',
  130. 'template_id' => $this->popup_key( 'content_elements' ),
  131. ),
  132.  
  133. array(
  134. 'type' => 'tab_close',
  135. 'nodescription' => true
  136. ),
  137.  
  138. array(
  139. 'type' => 'tab',
  140. 'name' => __( 'Styling', 'avia_framework' ),
  141. 'nodescription' => true
  142. ),
  143.  
  144. array(
  145. 'type' => 'template',
  146. 'template_id' => 'toggle_container',
  147. 'templates_include' => array(
  148. $this->popup_key( 'styling_grid' ),
  149. $this->popup_key( 'styling_padding' ),
  150. $this->popup_key( 'styling_fonts' ),
  151. $this->popup_key( 'styling_font_colors' ),
  152. $this->popup_key( 'styling_background_colors' ),
  153. $this->popup_key( 'styling_borders' ),
  154. $this->popup_key( 'styling_boxshadow' ),
  155. ),
  156. 'nodescription' => true
  157. ),
  158.  
  159. array(
  160. 'type' => 'tab_close',
  161. 'nodescription' => true
  162. ),
  163.  
  164. array(
  165. 'type' => 'tab',
  166. 'name' => __( 'Advanced', 'avia_framework' ),
  167. 'nodescription' => true
  168. ),
  169.  
  170. array(
  171. 'type' => 'toggle_container',
  172. 'nodescription' => true
  173. ),
  174.  
  175. array(
  176. 'type' => 'template',
  177. 'template_id' => $this->popup_key( 'advanced_animation' ),
  178. ),
  179.  
  180.  
  181. array(
  182. 'type' => 'template',
  183. 'template_id' => 'screen_options_toggle',
  184. 'lockable' => true,
  185. 'templates_include' => array(
  186. $this->popup_key( 'advanced_mobile' ),
  187. 'screen_options_visibility'
  188. ),
  189. ),
  190.  
  191. array(
  192. 'type' => 'template',
  193. 'template_id' => 'developer_options_toggle',
  194. 'args' => array( 'sc' => $this )
  195. ),
  196.  
  197. array(
  198. 'type' => 'toggle_container_close',
  199. 'nodescription' => true
  200. ),
  201.  
  202. array(
  203. 'type' => 'tab_close',
  204. 'nodescription' => true
  205. ),
  206.  
  207. array(
  208. 'type' => 'template',
  209. 'template_id' => 'element_template_selection_tab',
  210. 'args' => array( 'sc' => $this )
  211. ),
  212.  
  213. array(
  214. 'type' => 'tab_container_close',
  215. 'nodescription' => true
  216. )
  217. );
  218. }
  219.  
  220. /**
  221. * Create and register templates for easier maintainance
  222. *
  223. * @since 4.6.4
  224. */
  225. protected function register_dynamic_templates()
  226. {
  227.  
  228. $this->register_modal_group_templates();
  229.  
  230. /**
  231. * Content Tab
  232. * ===========
  233. */
  234.  
  235. $c = array(
  236. array(
  237. 'name' => __( 'Add/Edit Grid items', 'avia_framework' ),
  238. 'desc' => __( 'Here you can add, remove and edit the items of your item grid.', 'avia_framework' ),
  239. 'type' => 'modal_group',
  240. 'id' => 'content',
  241. 'modal_title' => __( 'Edit Grid Item', 'avia_framework' ),
  242. 'editable_item' => true,
  243. 'lockable' => true,
  244. 'std' => array(
  245. array(
  246. 'title' => __( 'Grid Title 1', 'avia_framework' ),
  247. 'icon' => '43',
  248. 'content' => __( 'Enter content here', 'avia_framework' ),
  249. ),
  250. array(
  251. 'title' => __( 'Grid Title 2', 'avia_framework' ),
  252. 'icon' => '25',
  253. 'content' => __( 'Enter content here', 'avia_framework' ),
  254. ),
  255. array(
  256. 'title' => __( 'Grid Title 3', 'avia_framework' ),
  257. 'icon' => '64',
  258. 'content' => __( 'Enter content here', 'avia_framework' ),
  259. ),
  260. ),
  261. 'subelements' => $this->create_modal()
  262. ),
  263.  
  264. array(
  265. 'name' => __( 'Content Appearance', 'avia_framework' ),
  266. 'desc' => __( 'Change the appearance of your icon grid', 'avia_framework' ),
  267. 'id' => 'icongrid_styling',
  268. 'type' => 'select',
  269. 'std' => 'flipbox',
  270. 'lockable' => true,
  271. 'subtype' => array(
  272. __( 'Content appears in Flip Box', 'avia_framework' ) => 'flipbox',
  273. __( 'Content appears in Tooltip', 'avia_framework' ) => 'tooltip',
  274. )
  275. ),
  276.  
  277. array(
  278. 'name' => __( 'Mobile Flip Box Close Behaviour', 'avia_framework' ),
  279. 'desc' => __( 'Select the behaviour of an open flipbox on mobile devices and touch screens', 'avia_framework' ),
  280. 'id' => 'flipbox_force_close',
  281. 'type' => 'select',
  282. 'std' => 'flipbox',
  283. 'lockable' => true,
  284. 'subtype' => array(
  285. __( 'Close only when visitor clicks in icongrid', 'avia_framework' ) => '',
  286. __( 'Also close when user clicks outside icongrid', 'avia_framework' ) => 'avia_flip_force_close',
  287. )
  288. ),
  289. );
  290.  
  291. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'content_elements' ), $c );
  292.  
  293. /**
  294. * Styling Tab
  295. * ============
  296. */
  297. $c = array(
  298. array(
  299. 'name' => __( 'Row Cells', 'avia_framework' ),
  300. 'desc' => __( 'Select the number of cells in a row. Each cell will contain 1 item and additional rows will be added to show all items. Consider the container size (e.g. column size) and the amount of text.', 'avia_framework' ),
  301. 'id' => 'icongrid_numrow',
  302. 'type' => 'select',
  303. 'std' => '3',
  304. 'lockable' => true,
  305. 'subtype' => array(
  306. __( '1 cell', 'avia_framework' ) => '1',
  307. __( '2 cells', 'avia_framework' ) => '2',
  308. __( '3 cells', 'avia_framework' ) => '3',
  309. __( '4 cells', 'avia_framework' ) => '4',
  310. __( '5 cells', 'avia_framework' ) => '5',
  311. )
  312. ),
  313.  
  314. // border options removed 4.8.8 as they are buggy.
  315. // array(
  316. // 'name' => __( 'Grid Borders', 'avia_framework' ),
  317. // 'desc' => __( 'Define the appearance of the grid borders here. Currently only &quot;No Borders&quot; is supported. Other options might be added in future.', 'avia_framework' ),
  318. // 'id' => 'icongrid_borders',
  319. // 'type' => 'select',
  320. // 'std' => 'none',
  321. // 'lockable' => true,
  322. // 'subtype' => array(
  323. // __( 'No Borders', 'avia_framework' ) => 'none',
  324. // __( '1px Borders between cells', 'avia_framework' ) => 'between',
  325. // __( '1px Borders around each cell', 'avia_framework' ) => 'all',
  326. // )
  327. // ),
  328.  
  329. );
  330.  
  331. $template = array(
  332. array(
  333. 'type' => 'template',
  334. 'template_id' => 'toggle',
  335. 'title' => __( 'Grid Styling', 'avia_framework' ),
  336. 'content' => $c
  337. ),
  338. );
  339.  
  340. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_grid' ), $template );
  341.  
  342.  
  343. $c = array(
  344. array(
  345. 'name' => __( 'Title Font Sizes', 'avia_framework' ),
  346. 'desc' => __( 'Select a custom font size for the titles.', 'avia_framework' ),
  347. 'type' => 'template',
  348. 'template_id' => 'font_sizes_icon_switcher',
  349. 'lockable' => true,
  350. 'textfield' => true,
  351. 'subtype' => array(
  352. 'default' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  353. 'desktop' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  354. 'medium' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  355. 'small' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  356. 'mini' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  357. ),
  358. 'id_sizes' => array(
  359. 'default' => 'custom_title_size',
  360. 'desktop' => 'av-desktop-font-size-title',
  361. 'medium' => 'av-medium-font-size-title',
  362. 'small' => 'av-small-font-size-title',
  363. 'mini' => 'av-mini-font-size-title'
  364. )
  365. ),
  366.  
  367. array(
  368. 'name' => __( 'Sub-Title Font Sizes', 'avia_framework' ),
  369. 'desc' => __( 'Select a custom font size for the sub titles.', 'avia_framework' ),
  370. 'type' => 'template',
  371. 'template_id' => 'font_sizes_icon_switcher',
  372. 'lockable' => true,
  373. 'textfield' => true,
  374. 'subtype' => array(
  375. 'default' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  376. 'desktop' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  377. 'medium' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  378. 'small' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  379. 'mini' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  380. ),
  381. 'id_sizes' => array(
  382. 'default' => 'custom_subtitle_size',
  383. 'desktop' => 'av-desktop-font-size-1',
  384. 'medium' => 'av-medium-font-size-1',
  385. 'small' => 'av-small-font-size-1',
  386. 'mini' => 'av-mini-font-size-1'
  387. )
  388. ),
  389.  
  390. array(
  391. 'name' => __( 'Content Font Sizes', 'avia_framework' ),
  392. 'desc' => __( 'Select a custom font size for the content on the backside of the flipbox or the tooltip.', 'avia_framework' ),
  393. 'type' => 'template',
  394. 'template_id' => 'font_sizes_icon_switcher',
  395. 'lockable' => true,
  396. 'textfield' => true,
  397. 'subtype' => array(
  398. 'default' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  399. 'desktop' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  400. 'medium' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  401. 'small' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  402. 'mini' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  403. ),
  404. 'id_sizes' => array(
  405. 'default' => 'custom_content_size',
  406. 'desktop' => 'av-desktop-font-size',
  407. 'medium' => 'av-medium-font-size',
  408. 'small' => 'av-small-font-size',
  409. 'mini' => 'av-mini-font-size'
  410. )
  411. ),
  412.  
  413. array(
  414. 'name' => __( 'Icon Font Sizes', 'avia_framework' ),
  415. 'desc' => __( 'Select a custom font size for the icon.', 'avia_framework' ),
  416. 'type' => 'template',
  417. 'template_id' => 'font_sizes_icon_switcher',
  418. 'lockable' => true,
  419. 'textfield' => true,
  420. 'subtype' => array(
  421. 'default' => AviaHtmlHelper::number_array( 10, 200, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  422. 'desktop' => AviaHtmlHelper::number_array( 10, 200, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  423. 'medium' => AviaHtmlHelper::number_array( 10, 200, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  424. 'small' => AviaHtmlHelper::number_array( 10, 200, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  425. 'mini' => AviaHtmlHelper::number_array( 10, 200, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  426. ),
  427. 'id_sizes' => array(
  428. 'default' => 'custom_icon_size',
  429. 'desktop' => 'av-desktop-font-size-2',
  430. 'medium' => 'av-medium-font-size-2',
  431. 'small' => 'av-small-font-size-2',
  432. 'mini' => 'av-mini-font-size-2'
  433. )
  434. )
  435.  
  436. );
  437.  
  438. $template = array(
  439. array(
  440. 'type' => 'template',
  441. 'template_id' => 'toggle',
  442. 'title' => __( 'Font Sizes', 'avia_framework' ),
  443. 'content' => $c
  444. ),
  445. );
  446.  
  447. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_fonts' ), $template );
  448.  
  449. $info = '<br /><strong>' . __( 'Important: To set padding to 0 you MUST use 0px or 0% (this is a backwards compatibility bug)', 'avia_framework' ) . '</strong>';
  450.  
  451. $c = array(
  452. array(
  453. 'type' => 'template',
  454. 'template_id' => 'padding',
  455. 'name' => __( 'Items Padding', 'avia_framework' ),
  456. 'desc' => __( 'Set the padding for the icongrid container. Both pixel and &percnt; based values are accepted. eg: 30px, 5&percnt;. Leave empty to use theme default.', 'avia_framework' ) . $info,
  457. 'id' => 'icongrid_padding',
  458. 'std' => '',
  459. )
  460. );
  461.  
  462. $template = array(
  463. array(
  464. 'type' => 'template',
  465. 'template_id' => 'toggle',
  466. 'title' => __( 'Padding', 'avia_framework' ),
  467. 'content' => $c
  468. ),
  469. );
  470.  
  471. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_padding' ), $template );
  472.  
  473. $c = array(
  474. array(
  475. 'name' => __( 'Font Colors', 'avia_framework' ),
  476. 'desc' => __( 'Either use the themes default colors or apply some custom ones', 'avia_framework' ),
  477. 'id' => 'font_color',
  478. 'type' => 'select',
  479. 'std' => '',
  480. 'lockable' => true,
  481. 'subtype' => array(
  482. __( 'Default', 'avia_framework' ) => '',
  483. __( 'Define Custom Colors', 'avia_framework' ) => 'custom'
  484. ),
  485. ),
  486.  
  487. array(
  488. 'name' => __( 'Custom Icon Font Color', 'avia_framework' ),
  489. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  490. 'id' => 'custom_icon',
  491. 'type' => 'colorpicker',
  492. 'rgba' => true,
  493. 'std' => '',
  494. 'container_class' => 'av_half av_half_first',
  495. 'lockable' => true,
  496. 'required' => array( 'font_color', 'equals', 'custom' )
  497. ),
  498.  
  499. array(
  500. 'name' => __( 'Custom Title Font Color', 'avia_framework' ),
  501. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  502. 'id' => 'custom_title',
  503. 'type' => 'colorpicker',
  504. 'rgba' => true,
  505. 'std' => '',
  506. 'container_class' => 'av_half',
  507. 'lockable' => true,
  508. 'required' => array( 'font_color', 'equals', 'custom' )
  509. ),
  510.  
  511. array(
  512. 'name' => __( 'Custom Sub-Title Font Color', 'avia_framework' ),
  513. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  514. 'id' => 'custom_subtitle',
  515. 'type' => 'colorpicker',
  516. 'rgba' => true,
  517. 'std' => '',
  518. 'container_class' => 'av_half',
  519. 'lockable' => true,
  520. 'required' => array( 'font_color', 'equals', 'custom' )
  521. ),
  522.  
  523. array(
  524. 'name' => __( 'Custom Content Font Color', 'avia_framework' ),
  525. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  526. 'id' => 'custom_content',
  527. 'type' => 'colorpicker',
  528. 'rgba' => true,
  529. 'std' => '',
  530. 'container_class' => 'av_half',
  531. 'lockable' => true,
  532. 'required' => array( 'font_color', 'equals', 'custom' )
  533. )
  534.  
  535. );
  536.  
  537. $template = array(
  538. array(
  539. 'type' => 'template',
  540. 'template_id' => 'toggle',
  541. 'title' => __( 'Font Colors', 'avia_framework' ),
  542. 'content' => $c
  543. ),
  544. );
  545.  
  546. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_font_colors' ), $template );
  547.  
  548. $c = array(
  549. array(
  550. 'name' => __( 'Background Colors', 'avia_framework' ),
  551. 'desc' => __( 'Either use the themes default colors or apply some custom ones', 'avia_framework' ),
  552. 'id' => 'bg_color',
  553. 'type' => 'select',
  554. 'std' => '',
  555. 'lockable' => true,
  556. 'subtype' => array(
  557. __( 'Default', 'avia_framework' ) => '',
  558. __( 'Define Custom Colors', 'avia_framework' ) => 'custom'
  559. ),
  560. ),
  561.  
  562. array(
  563. 'name' => __( 'Custom Background Front','avia_framework' ),
  564. 'desc' => __( 'Select the type of background.', 'avia_framework' ),
  565. 'id' => 'custom_front_bg_type',
  566. 'type' => 'select',
  567. 'std' => 'bg_color',
  568. 'lockable' => true,
  569. 'required' => array( 'bg_color', 'equals', 'custom' ),
  570. 'subtype' => array(
  571. __( 'Background Color', 'avia_framework' ) => 'bg_color',
  572. __( 'Background Gradient', 'avia_framework' ) => 'bg_gradient',
  573. )
  574. ),
  575.  
  576. array(
  577. 'name' => __( 'Custom Background Color Front', 'avia_framework' ),
  578. 'desc' => __( 'Select a custom background color. Leave empty to use the default', 'avia_framework' ),
  579. 'id' => 'custom_front_bg',
  580. 'type' => 'colorpicker',
  581. 'rgba' => true,
  582. 'std' => '',
  583. 'lockable' => true,
  584. 'required' => array( 'custom_front_bg_type', 'equals', 'bg_color' )
  585. ),
  586.  
  587. array(
  588. 'type' => 'template',
  589. 'template_id' => 'gradient_colors',
  590. 'id' => array(
  591. 'custom_front_gradient_direction',
  592. 'custom_front_gradient_color1',
  593. 'custom_front_gradient_color2',
  594. 'custom_front_gradient_color3'
  595. ),
  596. 'lockable' => true,
  597. 'required' => array( 'custom_front_bg_type', 'equals', 'bg_gradient' )
  598. ),
  599.  
  600. array(
  601. 'name' => __( 'Custom Background Back / Tooltip', 'avia_framework' ),
  602. 'desc' => __( 'Select the type of background.', 'avia_framework' ),
  603. 'id' => 'custom_back_bg_type',
  604. 'type' => 'select',
  605. 'std' => 'bg_color',
  606. 'lockable' => true,
  607. 'required' => array( 'bg_color', 'equals', 'custom' ),
  608. 'subtype' => array(
  609. __( 'Background Color','avia_framework' ) => 'bg_color',
  610. __( 'Background Gradient','avia_framework' ) => 'bg_gradient',
  611. )
  612. ),
  613.  
  614. array(
  615. 'name' => __( 'Custom Background Color Back / Tooltip', 'avia_framework' ),
  616. 'desc' => __( 'Select a custom background color. Leave empty to use the default', 'avia_framework' ),
  617. 'id' => 'custom_back_bg',
  618. 'type' => 'colorpicker',
  619. 'rgba' => true,
  620. 'std' => '',
  621. 'lockable' => true,
  622. 'required' => array( 'custom_back_bg_type', 'equals', 'bg_color' )
  623. ),
  624.  
  625. array(
  626. 'type' => 'template',
  627. 'template_id' => 'gradient_colors',
  628. 'id' => array(
  629. 'custom_back_gradient_direction',
  630. 'custom_back_gradient_color1',
  631. 'custom_back_gradient_color2',
  632. 'custom_back_gradient_color3'
  633. ),
  634. 'lockable' => true,
  635. 'required' => array( 'custom_back_bg_type', 'equals', 'bg_gradient' )
  636. )
  637. );
  638.  
  639. $template = array(
  640. array(
  641. 'type' => 'template',
  642. 'template_id' => 'toggle',
  643. 'title' => __( 'Background Colors', 'avia_framework' ),
  644. 'content' => $c
  645. ),
  646. );
  647.  
  648. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_background_colors' ), $template );
  649.  
  650. $c = array(
  651. // array(
  652. // 'name' => __( 'Custom Grid Border Color', 'avia_framework' ),
  653. // 'desc' => __( 'Select a custom grid color. Leave empty to use the theme default', 'avia_framework' ),
  654. // 'id' => 'custom_grid',
  655. // 'type' => 'colorpicker',
  656. // 'rgba' => true,
  657. // 'std' => '',
  658. // 'lockable' => true,
  659. // 'required' => array( 'icongrid_borders', 'parent_in_array', 'between,all' )
  660. // ),
  661.  
  662. array(
  663. 'type' => 'template',
  664. 'template_id' => 'border',
  665. 'id' => 'border_front',
  666. 'names' => array(
  667. 'style' => __( 'Border Style Item', 'avia_framework' ),
  668. 'width' => __( 'Border Width Item', 'avia_framework' ),
  669. 'color' => __( 'Border Color Item', 'avia_framework' )
  670. ),
  671. 'default_check' => true,
  672. 'lockable' => true
  673. ),
  674.  
  675. array(
  676. 'type' => 'template',
  677. 'template_id' => 'border',
  678. 'id' => 'border_flip',
  679. 'names' => array(
  680. 'style' => __( 'Border Style Flipbox (= Backside)', 'avia_framework' ),
  681. 'width' => __( 'Border Width Flipbox (= Backside)', 'avia_framework' ),
  682. 'color' => __( 'Border Color Flipbox (= Backside)', 'avia_framework' )
  683. ),
  684. 'default_check' => true,
  685. 'lockable' => true,
  686. 'required' => array( 'icongrid_styling', 'not', 'tooltip' )
  687. ),
  688.  
  689. array(
  690. 'type' => 'template',
  691. 'template_id' => 'border_radius',
  692. 'id' => 'border_radius',
  693. 'name' => __( 'Border Radius (Front And Flipbox Backside)', 'avia_framework' ),
  694. 'lockable' => true,
  695. 'required' => array( 'icongrid_styling', 'not', 'tooltip' ),
  696. ),
  697.  
  698. array(
  699. 'type' => 'template',
  700. 'template_id' => 'border',
  701. 'id' => 'border_tooltip',
  702. 'names' => array(
  703. 'style' => __( 'Border Style Tooltip', 'avia_framework' ),
  704. 'width' => __( 'Border Width Tooltip', 'avia_framework' ),
  705. 'color' => __( 'Border Color Tooltip', 'avia_framework' )
  706. ),
  707. 'default_check' => true,
  708. 'lockable' => true,
  709. 'required' => array( 'icongrid_styling', 'equals', 'tooltip' ),
  710. ),
  711.  
  712. array(
  713. 'type' => 'template',
  714. 'template_id' => 'border_radius',
  715. 'id' => 'border_radius_tooltip',
  716. 'name' => __( 'Border Radius Tooltip', 'avia_framework' ),
  717. 'lockable' => true,
  718. 'required' => array( 'icongrid_styling', 'equals', 'tooltip' ),
  719. )
  720.  
  721. );
  722.  
  723. $template = array(
  724. array(
  725. 'type' => 'template',
  726. 'template_id' => 'toggle',
  727. 'title' => __( 'Borders', 'avia_framework' ),
  728. 'content' => $c
  729. ),
  730. );
  731.  
  732. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_borders' ), $template );
  733.  
  734. $c = array(
  735.  
  736. array(
  737. 'type' => 'template',
  738. 'template_id' => 'box_shadow',
  739. 'default_check' => true,
  740. 'lockable' => true
  741. ),
  742.  
  743. array(
  744. 'type' => 'template',
  745. 'template_id' => 'box_shadow',
  746. 'id' => 'box_shadow_flip',
  747. 'names' => array(
  748. __( 'Box Shadow Flipbox (= Backside)', 'avia_framework' ),
  749. __( 'Box Shadow Styling Flipbox (= Backside)', 'avia_framework' ),
  750. __( 'Box Shadow Color Flipbox (= Backside)', 'avia_framework' )
  751. ),
  752. 'default_check' => true,
  753. 'lockable' => true,
  754. 'required' => array( 'icongrid_styling', 'not', 'tooltip' )
  755. ),
  756.  
  757. array(
  758. 'type' => 'template',
  759. 'template_id' => 'box_shadow',
  760. 'id' => 'box_shadow_tooltip',
  761. 'names' => array(
  762. __( 'Box Shadow Tooltip', 'avia_framework' ),
  763. __( 'Box Shadow Styling Tooltip', 'avia_framework' ),
  764. __( 'Box Shadow Color Tooltip', 'avia_framework' )
  765. ),
  766. 'default_check' => true,
  767. 'lockable' => true,
  768. 'required' => array( 'icongrid_styling', 'equals', 'tooltip' )
  769. )
  770.  
  771. );
  772.  
  773. $template = array(
  774. array(
  775. 'type' => 'template',
  776. 'template_id' => 'toggle',
  777. 'title' => __( 'Box Shadow', 'avia_framework' ),
  778. 'content' => $c
  779. ),
  780. );
  781.  
  782. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_boxshadow' ), $template );
  783.  
  784.  
  785. /**
  786. * Animation Tab
  787. * =============
  788. */
  789.  
  790. $c = array(
  791. array(
  792. 'name' => __( 'Rotation Of Flip Box', 'avia_framework' ),
  793. 'desc' => __( 'Select the rotation axis for the flip box', 'avia_framework' ),
  794. 'id' => 'flip_axis',
  795. 'type' => 'select',
  796. 'std' => '',
  797. 'lockable' => true,
  798. 'required' => array( 'icongrid_styling', 'equals', 'flipbox' ),
  799. 'subtype' => array(
  800. __( 'Rotate Y-axis', 'avia_framework' ) => '',
  801. __( 'Rotate X-axis', 'avia_framework' ) => 'avia-flip-x',
  802. )
  803. )
  804.  
  805. );
  806.  
  807. $template = array(
  808. array(
  809. 'type' => 'template',
  810. 'template_id' => 'toggle',
  811. 'title' => __( 'Animation', 'avia_framework' ),
  812. 'content' => $c
  813. ),
  814. );
  815.  
  816. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_animation' ), $template );
  817.  
  818. $c = array(
  819. array(
  820. 'name' => __( 'Mobile Behaviour', 'avia_framework' ),
  821. 'desc' => __( 'Choose how the cells inside the grid should behave on mobile devices and small screens', 'avia_framework' ),
  822. 'id' => 'mobile',
  823. 'type' => 'select',
  824. 'std' => '',
  825. 'lockable' => true,
  826. 'subtype' => array(
  827. __( 'Change layout on mobile devices', 'avia_framework' ) => '',
  828. __( 'Keep selected layout just like on large screens', 'avia_framework' ) => 'av-fixed-cells',
  829. )
  830. ),
  831.  
  832. array(
  833. 'name' => __( 'Mobile Breaking Points', 'avia_framework' ),
  834. 'desc' => __( 'Set the screen width when cells in a row should switch to fullwidth (or 50%)', 'avia_framework' ),
  835. 'type' => 'heading',
  836. 'required' => array( 'mobile', 'not', 'av-fixed-cells' ),
  837. 'description_class' => 'av-builder-note av-neutral'
  838. ),
  839.  
  840. array(
  841. 'name' => __( 'Responsive Break Points', 'avia_framework' ),
  842. 'desc' => __( 'The cells in a row will switch to 50% width or fullwidth at these screen widths', 'avia_framework' ),
  843. 'id' => 'mobile_breaking',
  844. 'type' => 'select',
  845. 'std' => '',
  846. 'lockable' => true,
  847. 'required' => array( 'mobile', 'not', 'av-fixed-cells' ),
  848. 'subtype' => array(
  849. __( 'To fullwidth at a screen width of 767px or lower', 'avia_framework' ) => '',
  850. __( 'To fullwidth at a screen width of 989px or lower', 'avia_framework' ) => 'av-break-989',
  851. __( 'To 50% at a screen width of 989px, to fullwidth on 767px', 'avia_framework' ) => 'av-50-break-989',
  852. __( 'To 50% at a screen width of 767px or lower', 'avia_framework' ) => 'av-50-break-767',
  853. )
  854. )
  855.  
  856. );
  857.  
  858. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_mobile' ), $c, true );
  859.  
  860. }
  861.  
  862. /**
  863. * Creates the modal popup for a single icongrid entry
  864. *
  865. * @since 4.6.4
  866. * @return array
  867. */
  868. protected function create_modal()
  869. {
  870. $elements = array(
  871.  
  872. array(
  873. 'type' => 'tab_container',
  874. 'nodescription' => true
  875. ),
  876.  
  877. array(
  878. 'type' => 'tab',
  879. 'name' => __( 'Content', 'avia_framework' ),
  880. 'nodescription' => true
  881. ),
  882.  
  883. array(
  884. 'type' => 'template',
  885. 'template_id' => 'toggle_container',
  886. 'templates_include' => array(
  887. $this->popup_key( 'modal_content_front' ),
  888. $this->popup_key( 'modal_content_back' ),
  889. ),
  890. 'nodescription' => true
  891. ),
  892.  
  893. array(
  894. 'type' => 'tab_close',
  895. 'nodescription' => true
  896. ),
  897.  
  898. array(
  899. 'type' => 'tab',
  900. 'name' => __( 'Styling', 'avia_framework' ),
  901. 'nodescription' => true
  902. ),
  903.  
  904. array(
  905. 'type' => 'template',
  906. 'template_id' => 'toggle_container',
  907. 'templates_include' => array(
  908. $this->popup_key( 'modal_styling_font_colors' ),
  909. $this->popup_key( 'modal_styling_background_colors' ),
  910. $this->popup_key( 'modal_styling_borders' ),
  911. $this->popup_key( 'modal_styling_boxshadow' )
  912. ),
  913. 'nodescription' => true
  914. ),
  915.  
  916. array(
  917. 'type' => 'tab_close',
  918. 'nodescription' => true
  919. ),
  920.  
  921. array(
  922. 'type' => 'tab',
  923. 'name' => __( 'Advanced', 'avia_framework' ),
  924. 'nodescription' => true
  925. ),
  926.  
  927. array(
  928. 'type' => 'template',
  929. 'template_id' => 'toggle_container',
  930. 'templates_include' => array(
  931. $this->popup_key( 'modal_advanced_heading' ),
  932. $this->popup_key( 'modal_advanced_link' )
  933. ),
  934. 'nodescription' => true
  935. ),
  936.  
  937. array(
  938. 'type' => 'tab_close',
  939. 'nodescription' => true
  940. ),
  941.  
  942. array(
  943. 'type' => 'template',
  944. 'template_id' => 'element_template_selection_tab',
  945. 'args' => array(
  946. 'sc' => $this,
  947. 'modal_group' => true
  948. )
  949. ),
  950.  
  951. array(
  952. 'type' => 'tab_container_close',
  953. 'nodescription' => true
  954. )
  955.  
  956. );
  957.  
  958. return $elements;
  959.  
  960. }
  961.  
  962. /**
  963. * Register all templates for the modal group popup
  964. *
  965. * @since 4.6.4
  966. */
  967. protected function register_modal_group_templates()
  968. {
  969. /**
  970. * Content Tab
  971. * ===========
  972. */
  973. $c = array(
  974. array(
  975. 'name' => __( 'Grid Item Title', 'avia_framework' ),
  976. 'desc' => __( 'Enter the grid item title here (Better keep it short)', 'avia_framework' ) ,
  977. 'id' => 'title',
  978. 'type' => 'input',
  979. 'std' => 'Grid Title',
  980. 'lockable' => true
  981. ),
  982.  
  983. array(
  984. 'name' => __( 'Grid Item Sub-Title', 'avia_framework' ),
  985. 'desc' => __( 'Enter the grid item sub-title here', 'avia_framework' ) ,
  986. 'id' => 'subtitle',
  987. 'type' => 'input',
  988. 'std' => 'Grid Sub-Title',
  989. 'lockable' => true
  990. ),
  991.  
  992. array(
  993. 'name' => __( 'Grid Item Icon', 'avia_framework' ),
  994. 'desc' => __( 'Select an icon for your grid item below', 'avia_framework' ),
  995. 'id' => 'icon',
  996. 'type' => 'iconfont',
  997. 'std' => '',
  998. 'lockable' => true,
  999. 'locked' => array( 'icon', 'font' )
  1000. )
  1001. );
  1002.  
  1003. $template = array(
  1004. array(
  1005. 'type' => 'template',
  1006. 'template_id' => 'toggle',
  1007. 'title' => __( 'Grid Element Front Content', 'avia_framework' ),
  1008. 'content' => $c
  1009. ),
  1010. );
  1011.  
  1012. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_content_front' ), $template );
  1013.  
  1014.  
  1015. $c = array(
  1016. array(
  1017. 'name' => __( 'Grid Item Content', 'avia_framework' ),
  1018. 'desc' => __( 'Enter some content here. Will be used as backside of flipbox or tooltip popup.', 'avia_framework' ) ,
  1019. 'id' => 'content',
  1020. 'type' => 'tiny_mce',
  1021. 'std' => __( 'Grid Content goes here', 'avia_framework' ),
  1022. 'lockable' => true
  1023. )
  1024. );
  1025.  
  1026. $template = array(
  1027. array(
  1028. 'type' => 'template',
  1029. 'template_id' => 'toggle',
  1030. 'title' => __( 'Grid Element Backside/Tooltip Content', 'avia_framework' ),
  1031. 'content' => $c
  1032. ),
  1033. );
  1034.  
  1035. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_content_back' ), $template );
  1036.  
  1037.  
  1038. /**
  1039. * Styling Tab
  1040. * ===========
  1041. */
  1042.  
  1043. $c = array(
  1044. array(
  1045. 'name' => __( 'Font Colors', 'avia_framework' ),
  1046. 'desc' => __( 'Either use the themes default colors or apply some custom ones', 'avia_framework' ),
  1047. 'id' => 'item_font_color',
  1048. 'type' => 'select',
  1049. 'std' => '',
  1050. 'lockable' => true,
  1051. 'subtype' => array(
  1052. __( 'Default', 'avia_framework' ) => '',
  1053. __( 'Define Custom Colors', 'avia_framework' ) => 'custom'
  1054. ),
  1055. ),
  1056.  
  1057. array(
  1058. 'name' => __( 'Custom Icon Font Color', 'avia_framework' ),
  1059. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  1060. 'id' => 'item_custom_icon',
  1061. 'type' => 'colorpicker',
  1062. 'rgba' => true,
  1063. 'std' => '',
  1064. 'container_class' => 'av_half av_half_first',
  1065. 'lockable' => true,
  1066. 'required' => array( 'item_font_color', 'equals', 'custom' )
  1067. ),
  1068.  
  1069. array(
  1070. 'name' => __( 'Custom Title Font Color', 'avia_framework' ),
  1071. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  1072. 'id' => 'item_custom_title',
  1073. 'type' => 'colorpicker',
  1074. 'rgba' => true,
  1075. 'std' => '',
  1076. 'container_class' => 'av_half',
  1077. 'lockable' => true,
  1078. 'required' => array( 'item_font_color', 'equals', 'custom' )
  1079. ),
  1080.  
  1081. array(
  1082. 'name' => __( 'Custom Sub-Title Font Color', 'avia_framework' ),
  1083. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  1084. 'id' => 'item_custom_subtitle',
  1085. 'type' => 'colorpicker',
  1086. 'rgba' => true,
  1087. 'std' => '',
  1088. 'container_class' => 'av_half',
  1089. 'lockable' => true,
  1090. 'required' => array( 'item_font_color', 'equals','custom' )
  1091. ),
  1092.  
  1093. array(
  1094. 'name' => __( 'Custom Content Font Color', 'avia_framework' ),
  1095. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  1096. 'id' => 'item_custom_content',
  1097. 'type' => 'colorpicker',
  1098. 'rgba' => true,
  1099. 'std' => '',
  1100. 'container_class' => 'av_half',
  1101. 'lockable' => true,
  1102. 'required' => array( 'item_font_color', 'equals', 'custom' )
  1103. )
  1104.  
  1105. );
  1106.  
  1107. $template = array(
  1108. array(
  1109. 'type' => 'template',
  1110. 'template_id' => 'toggle',
  1111. 'title' => __( 'Font Colors', 'avia_framework' ),
  1112. 'content' => $c
  1113. ),
  1114. );
  1115.  
  1116. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_font_colors' ), $template );
  1117.  
  1118. $c = array(
  1119. array(
  1120. 'name' => __( 'Background Colors', 'avia_framework' ),
  1121. 'desc' => __( 'Either use the themes default colors or apply some custom ones', 'avia_framework' ),
  1122. 'id' => 'item_bg_color',
  1123. 'type' => 'select',
  1124. 'std' => '',
  1125. 'lockable' => true,
  1126. 'subtype' => array(
  1127. __( 'Default', 'avia_framework' ) => '',
  1128. __( 'Define Custom Colors', 'avia_framework' ) => 'custom'
  1129. ),
  1130. ),
  1131.  
  1132. array(
  1133. 'name' => __( 'Custom Background Front', 'avia_framework' ),
  1134. 'desc' => __( 'Select the type of background.', 'avia_framework' ),
  1135. 'id' => 'item_custom_front_bg_type',
  1136. 'type' => 'select',
  1137. 'std' => 'bg_color',
  1138. 'lockable' => true,
  1139. 'required' => array( 'item_bg_color', 'equals', 'custom' ),
  1140. 'subtype' => array(
  1141. __( 'Background Color', 'avia_framework' ) => 'bg_color',
  1142. __( 'Background Gradient', 'avia_framework' ) => 'bg_gradient',
  1143. )
  1144. ),
  1145.  
  1146. array(
  1147. 'name' => __( 'Custom Background Color Front', 'avia_framework' ),
  1148. 'desc' => __( 'Select a custom background color. Leave empty to use the default', 'avia_framework' ),
  1149. 'id' => 'item_custom_front_bg',
  1150. 'type' => 'colorpicker',
  1151. 'rgba' => true,
  1152. 'std' => '',
  1153. 'container_class' => 'av_half av_half_first',
  1154. 'lockable' => true,
  1155. 'required' => array( 'item_custom_front_bg_type', 'equals', 'bg_color' )
  1156. ),
  1157.  
  1158. array(
  1159. 'type' => 'template',
  1160. 'template_id' => 'gradient_colors',
  1161. 'id' => array(
  1162. 'item_custom_front_gradient_direction',
  1163. 'item_custom_front_gradient_color1',
  1164. 'item_custom_front_gradient_color2',
  1165. 'item_custom_front_gradient_color3'
  1166. ),
  1167. 'lockable' => true,
  1168. 'required' => array( 'item_custom_front_bg_type', 'equals', 'bg_gradient' )
  1169. ),
  1170.  
  1171. array(
  1172. 'name' => __( 'Custom Background Back / Tooltip','avia_framework' ),
  1173. 'desc' => __( 'Select the type of background.', 'avia_framework' ),
  1174. 'id' => 'item_custom_back_bg_type',
  1175. 'type' => 'select',
  1176. 'std' => 'bg_color',
  1177. 'lockable' => true,
  1178. 'required' => array( 'item_bg_color', 'equals', 'custom' ),
  1179. 'subtype' => array(
  1180. __( 'Background Color', 'avia_framework' ) => 'bg_color',
  1181. __( 'Background Gradient', 'avia_framework' ) => 'bg_gradient',
  1182. )
  1183. ),
  1184.  
  1185. array(
  1186. 'name' => __( 'Custom Background Color Back / Tooltip', 'avia_framework' ),
  1187. 'desc' => __( 'Select a custom background color. Leave empty to use the default', 'avia_framework' ),
  1188. 'id' => 'item_custom_back_bg',
  1189. 'type' => 'colorpicker',
  1190. 'rgba' => true,
  1191. 'std' => '',
  1192. 'lockable' => true,
  1193. 'required' => array( 'item_custom_back_bg_type', 'equals', 'bg_color' )
  1194. ),
  1195.  
  1196. array(
  1197. 'type' => 'template',
  1198. 'template_id' => 'gradient_colors',
  1199. 'id' => array(
  1200. 'item_custom_back_gradient_direction',
  1201. 'item_custom_back_gradient_color1',
  1202. 'item_custom_back_gradient_color2',
  1203. 'item_custom_back_gradient_color3'
  1204. ),
  1205. 'lockable' => true,
  1206. 'required' => array( 'item_custom_back_bg_type', 'equals', 'bg_gradient' )
  1207. )
  1208.  
  1209. );
  1210.  
  1211. $template = array(
  1212. array(
  1213. 'type' => 'template',
  1214. 'template_id' => 'toggle',
  1215. 'title' => __( 'Background Colors', 'avia_framework' ),
  1216. 'content' => $c
  1217. ),
  1218. );
  1219.  
  1220. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_background_colors' ), $template );
  1221.  
  1222.  
  1223. $c = array(
  1224. array(
  1225. 'type' => 'template',
  1226. 'template_id' => 'border',
  1227. 'id' => 'item_border_front',
  1228. 'names' => array(
  1229. 'style' => __( 'Border Style Item', 'avia_framework' ),
  1230. 'width' => __( 'Border Width Item', 'avia_framework' ),
  1231. 'color' => __( 'Border Color Item', 'avia_framework' )
  1232. ),
  1233. 'default_check' => true,
  1234. 'lockable' => true
  1235. ),
  1236.  
  1237. array(
  1238. 'type' => 'template',
  1239. 'template_id' => 'border',
  1240. 'id' => 'item_border_flip',
  1241. 'names' => array(
  1242. 'style' => __( 'Border Style Flipbox (= Backside)', 'avia_framework' ),
  1243. 'width' => __( 'Border Width Flipbox (= Backside)', 'avia_framework' ),
  1244. 'color' => __( 'Border Color Flipbox (= Backside)', 'avia_framework' )
  1245. ),
  1246. 'default_check' => true,
  1247. 'lockable' => true
  1248. ),
  1249.  
  1250. array(
  1251. 'type' => 'template',
  1252. 'template_id' => 'border_radius',
  1253. 'id' => 'item_border_radius',
  1254. 'name' => __( 'Border Radius (Front And Flipbox Backside)', 'avia_framework' ),
  1255. 'lockable' => true
  1256. ),
  1257.  
  1258. array(
  1259. 'type' => 'template',
  1260. 'template_id' => 'border',
  1261. 'id' => 'item_border_tooltip',
  1262. 'names' => array(
  1263. 'style' => __( 'Border Style Tooltip', 'avia_framework' ),
  1264. 'width' => __( 'Border Width Tooltip', 'avia_framework' ),
  1265. 'color' => __( 'Border Color Tooltip', 'avia_framework' )
  1266. ),
  1267. 'default_check' => true,
  1268. 'lockable' => true
  1269. ),
  1270.  
  1271. array(
  1272. 'type' => 'template',
  1273. 'template_id' => 'border_radius',
  1274. 'id' => 'item_border_radius_tooltip',
  1275. 'name' => __( 'Border Radius Tooltip', 'avia_framework' ),
  1276. 'lockable' => true
  1277. ),
  1278.  
  1279. );
  1280.  
  1281. $template = array(
  1282. array(
  1283. 'type' => 'template',
  1284. 'template_id' => 'toggle',
  1285. 'title' => __( 'Borders', 'avia_framework' ),
  1286. 'content' => $c
  1287. ),
  1288. );
  1289.  
  1290. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_borders' ), $template );
  1291.  
  1292. $c = array(
  1293.  
  1294. array(
  1295. 'type' => 'template',
  1296. 'template_id' => 'box_shadow',
  1297. 'id' => 'item_box_shadow',
  1298. 'default_check' => true,
  1299. 'lockable' => true
  1300. ),
  1301.  
  1302. array(
  1303. 'type' => 'template',
  1304. 'template_id' => 'box_shadow',
  1305. 'id' => 'item_box_shadow_flip',
  1306. 'names' => array(
  1307. __( 'Box Shadow Flipbox (= Backside)', 'avia_framework' ),
  1308. __( 'Box Shadow Styling Flipbox (= Backside)', 'avia_framework' ),
  1309. __( 'Box Shadow Color Flipbox (= Backside)', 'avia_framework' )
  1310. ),
  1311. 'default_check' => true,
  1312. 'lockable' => true
  1313. ),
  1314.  
  1315. array(
  1316. 'type' => 'template',
  1317. 'template_id' => 'box_shadow',
  1318. 'id' => 'item_box_shadow_tooltip',
  1319. 'names' => array(
  1320. __( 'Box Shadow Tooltip', 'avia_framework' ),
  1321. __( 'Box Shadow Styling Tooltip', 'avia_framework' ),
  1322. __( 'Box Shadow Color Tooltip', 'avia_framework' )
  1323. ),
  1324. 'default_check' => true,
  1325. 'lockable' => true
  1326. )
  1327.  
  1328. );
  1329.  
  1330. $template = array(
  1331. array(
  1332. 'type' => 'template',
  1333. 'template_id' => 'toggle',
  1334. 'title' => __( 'Box Shadow', 'avia_framework' ),
  1335. 'content' => $c
  1336. ),
  1337. );
  1338.  
  1339. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_boxshadow' ), $template );
  1340.  
  1341.  
  1342. /**
  1343. * Advanced Tab
  1344. * ============
  1345. */
  1346.  
  1347. $c = array(
  1348. array(
  1349. 'type' => 'template',
  1350. 'template_id' => 'heading_tag',
  1351. 'theme_default' => 'h4',
  1352. 'context' => __CLASS__,
  1353. 'lockable' => true,
  1354. ),
  1355.  
  1356. );
  1357.  
  1358. $template = array(
  1359. array(
  1360. 'type' => 'template',
  1361. 'template_id' => 'toggle',
  1362. 'title' => __( 'Heading Tag', 'avia_framework' ),
  1363. 'content' => $c
  1364. ),
  1365. );
  1366.  
  1367. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_advanced_heading' ), $template );
  1368.  
  1369.  
  1370. $c = array(
  1371. array(
  1372. 'type' => 'template',
  1373. 'template_id' => 'linkpicker_toggle',
  1374. 'name' => __( 'Title Link?', 'avia_framework' ),
  1375. 'desc' => __( 'Do you want to apply a link to the title?', 'avia_framework' ),
  1376. 'lockable' => true,
  1377. 'subtypes' => array( 'no', 'manually', 'single', 'taxonomy' ),
  1378. // 'no_toggle' => true
  1379. )
  1380.  
  1381. );
  1382.  
  1383. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_advanced_link' ), $c );
  1384.  
  1385. }
  1386.  
  1387. /**
  1388. * Editor Sub Element - this function defines the visual appearance of an element that is displayed within a modal window and on click opens its own modal window
  1389. * Works in the same way as Editor Element
  1390. *
  1391. * @param array $params holds the default values for $content and $args.
  1392. * @return array usually holds an innerHtml key that holds item specific markup.
  1393. */
  1394. public function editor_sub_element( $params )
  1395. {
  1396. $default = array();
  1397. $locked = array();
  1398. $attr = $params['args'];
  1399. Avia_Element_Templates()->set_locked_attributes( $attr, $this, $this->config['shortcode_nested'][0], $default, $locked );
  1400.  
  1401. $template = $this->update_template_lockable( 'title', __( 'Element', 'avia_framework' ). ': {{title}}', $locked );
  1402.  
  1403. extract( av_backend_icon( array( 'args' => $attr ) ) ); // creates $font and $display_char if the icon was passed as param 'icon" and the font as "font"
  1404.  
  1405. $params['innerHtml'] = '';
  1406. $params['innerHtml'] .= "<div class='avia_title_container' data-update_element_template='yes'>";
  1407. $params['innerHtml'] .= '<span ' . $this->class_by_arguments_lockable( 'font', $font, $locked ) . '>';
  1408. $params['innerHtml'] .= '<span ' . $this->update_option_lockable( array( 'icon', 'icon_fakeArg' ), $locked ) . " class='avia_tab_icon'>{$display_char}</span>";
  1409. $params['innerHtml'] .= '</span>';
  1410. $params['innerHtml'] .= "<span {$template} >" . __( 'Element', 'avia_framework' ) . ": {$attr['title']}</span>";
  1411. $params['innerHtml'] .= '</div>';
  1412.  
  1413. return $params;
  1414. }
  1415.  
  1416. /**
  1417. * Create custom stylings
  1418. *
  1419. * @since 4.8.8
  1420. * @param array $args
  1421. * @return array
  1422. */
  1423. protected function get_element_styles( array $args )
  1424. {
  1425. $result = parent::get_element_styles( $args );
  1426.  
  1427. extract( $result );
  1428.  
  1429. $default = array(
  1430. 'font_color' => '',
  1431. 'custom_icon' => '',
  1432. 'custom_title' => '',
  1433. 'custom_subtitle' => '',
  1434. 'custom_content' => '',
  1435. 'icongrid_padding' => '',
  1436. 'bg_color' => '',
  1437. 'custom_front_bg_type' => '',
  1438. 'custom_front_bg' => '',
  1439. 'custom_front_gradient_color1' => '',
  1440. 'custom_front_gradient_color2' => '',
  1441. 'custom_front_gradient_direction' => '',
  1442. 'custom_back_bg_type' => '',
  1443. 'custom_back_bg' => '',
  1444. 'custom_back_gradient_color1' => '',
  1445. 'custom_back_gradient_color2' => '',
  1446. 'custom_back_gradient_direction' => '',
  1447. 'icongrid_styling' => 'flipbox',
  1448. 'flipbox_force_close' => '',
  1449. 'flip_axis' => '',
  1450. 'icongrid_numrow' => '',
  1451. 'icongrid_borders' => 'none',
  1452. 'custom_title_size' => '',
  1453. 'custom_subtitle_size' => '',
  1454. 'custom_content_size' => '',
  1455. 'custom_icon_size' => '',
  1456. 'mobile' => '',
  1457. 'mobile_breaking' => ''
  1458. );
  1459.  
  1460. $default = $this->sync_sc_defaults_array( $default, 'no_modal_item', 'no_content' );
  1461.  
  1462. $locked = array();
  1463. Avia_Element_Templates()->set_locked_attributes( $atts, $this, $shortcodename, $default, $locked, $content );
  1464. Avia_Element_Templates()->add_template_class( $meta, $atts, $default );
  1465.  
  1466. $this->in_sc_exec = true;
  1467. $this->numrow = $atts['icongrid_numrow'];
  1468. $this->row_count = 1;
  1469. $this->item_count = 0;
  1470. $this->row_item = 0;
  1471.  
  1472. $atts = shortcode_atts( $default, $atts, $this->config['shortcode'] );
  1473.  
  1474. // @since 4.8.8 remove buggy borders
  1475. $atts['icongrid_borders'] = 'none';
  1476. $atts['custom_grid'] = '';
  1477.  
  1478. // fix a backwards comp. bug with wrong atts
  1479. $atts['size-title'] = $atts['custom_title_size'];
  1480. $atts['size-1'] = $atts['custom_subtitle_size'];
  1481. $atts['size'] = $atts['custom_content_size'];
  1482. $atts['size-2'] = $atts['custom_icon_size'];
  1483.  
  1484. $element_styling->create_callback_styles( $atts );
  1485.  
  1486.  
  1487. $classes = array(
  1488. 'avia-icon-grid-container',
  1489. $element_id,
  1490. $atts['flip_axis']
  1491. );
  1492.  
  1493. $element_styling->add_classes( 'container', $classes );
  1494. $element_styling->add_classes_from_array( 'container', $meta, 'el_class' );
  1495. $element_styling->add_responsive_classes( 'container', 'hide_element', $atts );
  1496. $element_styling->add_responsive_font_sizes( 'li-front-title', 'size-title', $atts, $this );
  1497. $element_styling->add_responsive_font_sizes( 'li-front-subtitle', 'size-1', $atts, $this );
  1498. $element_styling->add_responsive_font_sizes( 'li-content-inner', 'size', $atts, $this );
  1499. $element_styling->add_responsive_font_sizes( 'li-flipback', 'size', $atts, $this );
  1500. $element_styling->add_responsive_font_sizes( 'li-front-icon', 'size-2', $atts, $this );
  1501.  
  1502. $classes = array(
  1503. 'avia-icongrid',
  1504. 'clearfix',
  1505. 'avia_animate_when_almost_visible',
  1506. "avia-icongrid-{$atts['icongrid_styling']}",
  1507. $atts['flipbox_force_close'],
  1508. "avia-icongrid-borders-{$atts['icongrid_borders']}",
  1509. "avia-icongrid-numrow-{$atts['icongrid_numrow']}",
  1510. );
  1511.  
  1512. if( 'av-fixed-cells' != $atts['mobile'] )
  1513. {
  1514. $classes[] = 'av-flex-cells';
  1515. $classes[] = ! empty( $atts['mobile_breaking'] ) ? $atts['mobile_breaking'] : 'av-break-767';
  1516. }
  1517. else
  1518. {
  1519. $classes[] = $atts['mobile'];
  1520. }
  1521.  
  1522. $element_styling->add_classes( 'container-ul', $classes );
  1523.  
  1524. if( 'custom' == $atts['bg_color'] )
  1525. {
  1526. if( 'bg_gradient' == $atts['custom_front_bg_type'] )
  1527. {
  1528. if( 'tooltip' == $atts['icongrid_styling'] )
  1529. {
  1530. $element_styling->add_callback_styles( 'li-article', array( 'custom_front_gradient_direction' ) );
  1531. }
  1532. else
  1533. {
  1534. $element_styling->add_callback_styles( 'li-front', array( 'custom_front_gradient_direction' ) );
  1535. }
  1536. }
  1537. else
  1538. {
  1539. if( 'tooltip' == $atts['icongrid_styling'] )
  1540. {
  1541. $element_styling->add_styles( 'li-article', array( 'background-color' => $atts['custom_front_bg'] ) );
  1542. }
  1543. else
  1544. {
  1545. $element_styling->add_styles( 'li-front', array( 'background-color' => $atts['custom_front_bg'] ) );
  1546. }
  1547. }
  1548.  
  1549. if( 'bg_gradient' == $atts['custom_back_bg_type'] )
  1550. {
  1551. $element_styling->add_callback_styles( 'li-content', array( 'custom_back_gradient_direction' ) );
  1552. $element_styling->add_callback_styles( 'li-flipback', array( 'custom_back_gradient_direction' ) );
  1553. }
  1554. else
  1555. {
  1556. $element_styling->add_styles( 'li-content', array( 'background-color' => $atts['custom_back_bg'] ) );
  1557. $element_styling->add_styles( 'li-flipback', array( 'background-color' => $atts['custom_back_bg'] ) );
  1558. }
  1559. }
  1560.  
  1561. // this is a bug from older versions < 4.8.8 where 0 was interpreted as not set
  1562. if( ! empty( $atts['icongrid_padding'] ) )
  1563. {
  1564. $element_styling->add_callback_styles( 'li-front', array( 'icongrid_padding' ) );
  1565. $element_styling->add_callback_styles( 'li-content', array( 'icongrid_padding' ) );
  1566. $element_styling->add_callback_styles( 'li-flipback', array( 'icongrid_padding' ) );
  1567. }
  1568.  
  1569. if( 'custom' == $atts['font_color'] )
  1570. {
  1571. $element_styling->add_styles( 'li-front-icon', array( 'color' => $atts['custom_icon'] ) );
  1572. $element_styling->add_styles( 'li-front-title', array( 'color' => $atts['custom_title'] ) );
  1573. $element_styling->add_styles( 'li-front-subtitle', array( 'color' => $atts['custom_subtitle'] ) );
  1574. $element_styling->add_styles( 'li-content-text', array( 'color' => $atts['custom_content'] ) );
  1575. $element_styling->add_styles( 'li-flipback-text', array( 'color' => $atts['custom_content'] ) );
  1576. }
  1577.  
  1578.  
  1579. if( $atts['icongrid_borders'] != 'none' )
  1580. {
  1581. $element_styling->add_styles( 'container-ul', array( 'border-color' => $atts['custom_grid'] ) );
  1582. // grid borders inside
  1583. $element_styling->add_styles( 'container-li', array( 'color' => $atts['custom_grid'] ) );
  1584. }
  1585.  
  1586. if( 'tooltip' == $atts['icongrid_styling'] )
  1587. {
  1588. $element_styling->add_callback_styles( 'li-article', array( 'border_front', 'border_radius', 'box_shadow' ) );
  1589. }
  1590. else
  1591. {
  1592. $element_styling->add_callback_styles( 'li-front', array( 'border_front', 'border_radius', 'box_shadow' ) );
  1593. }
  1594.  
  1595. $element_styling->add_callback_styles( 'li-flipback', array( 'border_flip', 'border_radius', 'box_shadow_flip' ) );
  1596. $element_styling->add_callback_styles( 'li-content', array( 'border_tooltip', 'border_radius_tooltip', 'box_shadow_tooltip' ) );
  1597.  
  1598. $selectors = array(
  1599. 'container' => ".avia-icon-grid-container.{$element_id}",
  1600. 'container-ul' => ".avia-icon-grid-container.{$element_id} .avia-icongrid",
  1601. 'container-li' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper",
  1602. 'li-article' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .article-icon-entry",
  1603. 'li-front' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-front",
  1604. 'li-front-icon' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-icon",
  1605. 'li-front-title' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .icongrid_title",
  1606. 'li-front-subtitle' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .icongrid_subtitle",
  1607. 'li-content' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-content",
  1608. 'li-content-inner' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-content .avia-icongrid-inner",
  1609. 'li-content-text' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-content .avia-icongrid-text",
  1610. 'li-flipback' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-flipback",
  1611. 'li-flipback-text' => ".avia-icon-grid-container.{$element_id} .avia-icongrid-wrapper .avia-icongrid-flipback .avia-icongrid-text",
  1612. );
  1613.  
  1614. $element_styling->add_selectors( $selectors );
  1615.  
  1616.  
  1617. $result['default'] = $default;
  1618. $result['atts'] = $atts;
  1619. $result['content'] = $content;
  1620. $result['element_styling'] = $element_styling;
  1621.  
  1622. $this->parent_atts = $atts;
  1623.  
  1624. return $result;
  1625. }
  1626.  
  1627. /**
  1628. * Create custom stylings for items
  1629. * (also called when creating header implicit)
  1630. *
  1631. * @since 4.8.8
  1632. * @param array $args
  1633. * @return array
  1634. */
  1635. protected function get_element_styles_item( array $args )
  1636. {
  1637. $result = parent::get_element_styles_item( $args );
  1638.  
  1639. extract( $result );
  1640.  
  1641. $default = array(
  1642. 'title' => '',
  1643. 'subtitle' => '',
  1644. 'link' => '',
  1645. 'icon' => '',
  1646. 'font' =>'',
  1647. 'linktarget' => '',
  1648. 'custom_markup' => '',
  1649. 'item_font_color' => '',
  1650. 'item_custom_icon' => '',
  1651. 'item_custom_title' => '',
  1652. 'item_custom_subtitle' => '',
  1653. 'item_custom_content' => '',
  1654. 'item_bg_color' => '',
  1655. 'item_custom_front_bg_type' => '',
  1656. 'item_custom_front_gradient_color1' => '',
  1657. 'item_custom_front_gradient_color2' => '',
  1658. 'item_custom_front_gradient_direction' => '',
  1659. 'item_custom_front_bg' => '',
  1660. 'item_custom_back_bg_type' => '',
  1661. 'item_custom_back_bg' => '',
  1662. 'item_custom_back_gradient_color1' => '',
  1663. 'item_custom_back_gradient_color2' => '',
  1664. 'item_custom_back_gradient_direction' => ''
  1665. );
  1666.  
  1667. $default = $this->sync_sc_defaults_array( $default, 'modal_item', 'no_content' );
  1668.  
  1669. $locked = array();
  1670. Avia_Element_Templates()->set_locked_attributes( $atts, $this, $this->config['shortcode_nested'][0], $default, $locked, $content );
  1671. $meta = aviaShortcodeTemplate::set_frontend_developer_heading_tag( $atts );
  1672.  
  1673. $atts = shortcode_atts( $default, $atts, $this->config['shortcode_nested'][0] );
  1674.  
  1675.  
  1676. $element_styling->create_callback_styles( $atts, true );
  1677.  
  1678.  
  1679. $classes = array(
  1680. 'avia-icongrid-wrapper',
  1681. $element_id
  1682. );
  1683.  
  1684. $element_styling->add_classes( 'container-li-wrapper', $classes );
  1685.  
  1686.  
  1687. if( 'custom' == $atts['item_bg_color'] )
  1688. {
  1689. if( 'bg_gradient' == $atts['item_custom_front_bg_type'] )
  1690. {
  1691. if( 'tooltip' == $this->parent_atts['icongrid_styling'] )
  1692. {
  1693. $element_styling->add_callback_styles( 'li-article', array( 'item_custom_front_gradient_direction' ) );
  1694. }
  1695. else
  1696. {
  1697. $element_styling->add_callback_styles( 'li-front', array( 'item_custom_front_gradient_direction' ) );
  1698. }
  1699. }
  1700. else
  1701. {
  1702. // avoid remove gradient from global settings
  1703. if( '' != $atts['item_custom_front_bg'] )
  1704. {
  1705. if( 'tooltip' == $this->parent_atts['icongrid_styling'] )
  1706. {
  1707. $element_styling->add_styles( 'li-article', array( 'background' => 'unset' ) );
  1708. $element_styling->add_styles( 'li-article', array( 'background-color' => $atts['item_custom_front_bg'] ) );
  1709. }
  1710. else
  1711. {
  1712. $element_styling->add_styles( 'li-front', array( 'background' => 'unset' ) );
  1713. $element_styling->add_styles( 'li-front', array( 'background-color' => $atts['item_custom_front_bg'] ) );
  1714. }
  1715. }
  1716. }
  1717.  
  1718. if( 'bg_gradient' == $atts['item_custom_back_bg_type'] )
  1719. {
  1720. $element_styling->add_callback_styles( 'li-content', array( 'item_custom_back_gradient_direction' ) );
  1721. $element_styling->add_callback_styles( 'li-flipback', array( 'item_custom_back_gradient_direction' ) );
  1722. }
  1723. else
  1724. {
  1725. // avoid remove gradient from global settings
  1726. if( '' != $atts['item_custom_back_bg'] )
  1727. {
  1728. $element_styling->add_styles( 'li-content', array( 'background' => 'unset' ) );
  1729. $element_styling->add_styles( 'li-flipback', array( 'background' => 'unset' ) );
  1730. $element_styling->add_styles( 'li-content', array( 'background-color' => $atts['item_custom_back_bg'] ) );
  1731. $element_styling->add_styles( 'li-flipback', array( 'background-color' => $atts['item_custom_back_bg'] ) );
  1732. }
  1733. }
  1734. }
  1735.  
  1736. if( 'custom' == $atts['item_font_color'] )
  1737. {
  1738. $element_styling->add_styles( 'li-front-icon', array( 'color' => $atts['item_custom_icon'] ) );
  1739. $element_styling->add_styles( 'li-front-title', array( 'color' => $atts['item_custom_title'] ) );
  1740. $element_styling->add_styles( 'li-front-subtitle', array( 'color' => $atts['item_custom_subtitle'] ) );
  1741. $element_styling->add_styles( 'li-content-text', array( 'color' => $atts['item_custom_content'] ) );
  1742. $element_styling->add_styles( 'li-flipback-text', array( 'color' => $atts['item_custom_content'] ) );
  1743. }
  1744.  
  1745. if( 'tooltip' == $this->parent_atts['icongrid_styling'] )
  1746. {
  1747. $element_styling->add_callback_styles( 'li-article', array( 'item_border_front', 'item_border_radius', 'item_box_shadow' ) );
  1748. }
  1749. else
  1750. {
  1751. $element_styling->add_callback_styles( 'li-front', array( 'item_border_front', 'item_border_radius', 'item_box_shadow' ) );
  1752. }
  1753.  
  1754. $element_styling->add_callback_styles( 'li-flipback', array( 'item_border_flip', 'item_border_radius', 'item_box_shadow_flip' ) );
  1755. $element_styling->add_callback_styles( 'li-content', array( 'item_border_tooltip', 'item_border_radius_tooltip', 'item_box_shadow_tooltip' ) );
  1756.  
  1757.  
  1758. // .avia-icon-grid-container needed to override global settings for all elements
  1759. $selectors = array(
  1760. 'container-li-wrapper' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id}",
  1761. 'li-article' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .article-icon-entry",
  1762. 'li-front' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .avia-icongrid-front",
  1763. 'li-front-icon' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .avia-icongrid-icon",
  1764. 'li-front-title' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .icongrid_title",
  1765. 'li-front-subtitle' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .icongrid_subtitle",
  1766. 'li-content' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .avia-icongrid-content",
  1767. 'li-flipback' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .avia-icongrid-flipback",
  1768. 'li-content-text' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .avia-icongrid-content .avia-icongrid-text",
  1769. 'li-flipback-text' => ".avia-icon-grid-container .avia-icongrid-wrapper.{$element_id} .avia-icongrid-flipback .avia-icongrid-text",
  1770. );
  1771.  
  1772. $element_styling->add_selectors( $selectors );
  1773.  
  1774. $result['default'] = $default;
  1775. $result['atts'] = $atts;
  1776. $result['content'] = $content;
  1777. $result['element_styling'] = $element_styling;
  1778. $result['meta'] = $meta;
  1779.  
  1780. return $result;
  1781. }
  1782.  
  1783. /**
  1784. * Frontend Shortcode Handler
  1785. *
  1786. * @param array $atts array of attributes
  1787. * @param string $content text within enclosing form of shortcode element
  1788. * @param string $shortcodename the shortcode found, when == callback name
  1789. * @return string $output returns the modified html string
  1790. */
  1791. public function shortcode_handler( $atts, $content = '', $shortcodename = '', $meta = '' )
  1792. {
  1793. global $avia_config;
  1794.  
  1795. $result = $this->get_element_styles( compact( array( 'atts', 'content', 'shortcodename', 'meta' ) ) );
  1796.  
  1797. extract( $result );
  1798. extract( $atts );
  1799.  
  1800. // fullwidth elements in text area will break layout - set a flag to check in ShortcodeHelper::is_top_level()
  1801. $avia_config['icongrid_container'] = 'icongrid';
  1802.  
  1803. $item_html = ShortcodeHelper::avia_remove_autop( $content, true );
  1804.  
  1805. unset( $avia_config['icongrid_container'] );
  1806.  
  1807. $style_tag = $element_styling->get_style_tag( $element_id );
  1808. $item_tag = $element_styling->style_tag_html( $this->subitem_inline_styles, 'sub-' . $element_id );
  1809. $container_class = $element_styling->get_class_string( 'container' );
  1810. $container_ul_class = $element_styling->get_class_string( 'container-ul' );
  1811.  
  1812. $output = '';
  1813. $output .= $style_tag;
  1814. $output .= $item_tag;
  1815. $output .= "<div {$meta['custom_el_id']} class='{$container_class}'>";
  1816. $output .= "<ul id='avia-icongrid-" . uniqid() . "' class='{$container_ul_class}'>";
  1817. $output .= $item_html;
  1818. $output .= '</ul>';
  1819. $output .= '</div>';
  1820.  
  1821. $this->in_sc_exec = false;
  1822. $this->subitem_inline_styles = '';
  1823.  
  1824. return $output;
  1825. }
  1826.  
  1827. /**
  1828. * Shortcode Handler
  1829. *
  1830. * @param array $atts
  1831. * @param string $content
  1832. * @param string $shortcodename
  1833. * @return string
  1834. */
  1835. public function av_icongrid_item( $atts, $content = '', $shortcodename = '' )
  1836. {
  1837. /**
  1838. * Fixes a problem when 3-rd party plugins call nested shortcodes without executing main shortcode (like YOAST in wpseo-filter-shortcodes)
  1839. */
  1840. if( empty( $this->in_sc_exec ) )
  1841. {
  1842. return '';
  1843. }
  1844.  
  1845. $result = $this->get_element_styles_item( compact( array( 'atts', 'content', 'shortcodename' ) ) );
  1846.  
  1847. extract( $result );
  1848.  
  1849. $avia_icongrid_wrapper = array(
  1850. 'start' => 'div',
  1851. 'end' => 'div'
  1852. );
  1853.  
  1854. if( ! empty( $atts['link'] ) )
  1855. {
  1856. $atts['link'] = AviaHelper::get_url( $atts['link'] );
  1857.  
  1858. if( ! empty( $atts['link'] ) )
  1859. {
  1860. $linktitle = $atts['title'];
  1861. $blank = AviaHelper::get_link_target( $atts['linktarget'] );
  1862.  
  1863. $avia_icongrid_wrapper['start'] = "a href='{$atts['link']}' title='" . esc_attr( $linktitle ) . "' {$blank}";
  1864. $avia_icongrid_wrapper['end'] = 'a';
  1865. }
  1866. }
  1867.  
  1868. $display_char = av_icon( $atts['icon'], $atts['font'] );
  1869. $title_el = ! empty( $meta['heading_tag'] ) ? $meta['heading_tag'] : 'h4';
  1870. $title_el_cls = ! empty( $meta['heading_class'] ) ? $meta['heading_class'] : '';
  1871. $contentClass = '' == trim( $content ) ? 'av-icongrid-empty' : '';
  1872.  
  1873. // create additional classes that might be necessary or styling grid with borders
  1874. $this->item_count ++;
  1875. $this->row_item ++;
  1876.  
  1877. if( $this->row_item > $this->numrow )
  1878. {
  1879. $this->row_item = 1;
  1880. $this->row_count ++;
  1881. }
  1882.  
  1883. $item_classes = array(
  1884. "av-row-with-{$this->numrow}-cells",
  1885. "av-row-nr-{$this->row_count}",
  1886. "av-cell-{$this->row_item}"
  1887. );
  1888.  
  1889. $item_classes[] = ( $this->item_count <= $this->numrow ) ? 'av-first-cell-row' : 'av-next-cell-row';
  1890.  
  1891. if( 1 == $this->numrow )
  1892. {
  1893. $item_classes[] = 'av-one-cell-item';
  1894. }
  1895. else
  1896. {
  1897. if( 1 == $this->row_item )
  1898. {
  1899. $item_classes[] = 'av-first-cell-item';
  1900. }
  1901. else if( $this->numrow == $this->row_item )
  1902. {
  1903. $item_classes[] = 'av-last-cell-item';
  1904. }
  1905. else
  1906. {
  1907. $item_classes[] = 'av-inner-cell-item';
  1908. }
  1909. }
  1910.  
  1911. $element_styling->add_classes( 'li-item', $item_classes );
  1912.  
  1913. $markup = avia_markup_helper( array( 'context' => 'entry_title', 'echo' => false, 'custom_markup' => $atts['custom_markup'] ) );
  1914. $markup_article = avia_markup_helper( array('context' => 'entry', 'echo' => false, 'custom_markup' => $atts['custom_markup'] ) );
  1915. $markup_sub = avia_markup_helper( array( 'context' => 'entry_subtitle', 'echo' => false, 'custom_markup' => $atts['custom_markup'] ) );
  1916. $markup_text = avia_markup_helper( array( 'context' => 'entry_content', 'echo' => false, 'custom_markup' => $atts['custom_markup'] ) );
  1917.  
  1918. /**
  1919. * @since 4.8.8
  1920. * @param string $heading_tag
  1921. * @param array $atts
  1922. * @param string $content
  1923. * @return string
  1924. */
  1925. $subtitle_el = apply_filters( 'avf_sc_icongrid_subtitle_heading_tag', 'h6', $atts, $content );
  1926.  
  1927.  
  1928. $container_class = $element_styling->get_class_string( 'container-li-wrapper' );
  1929. $item_class = $element_styling->get_class_string( 'li-item' );
  1930. $this->subitem_inline_styles .= $element_styling->get_style_tag( $element_id, 'rules_only' );
  1931.  
  1932. $output = '';
  1933. $output .= "<li class='{$item_class}'>";
  1934. $output .= "<{$avia_icongrid_wrapper['start']} class='{$container_class}'>";
  1935. $output .= "<article class='article-icon-entry {$contentClass}' {$markup_article}>";
  1936. $output .= '<div class="avia-icongrid-front">';
  1937. $output .= '<div class="avia-icongrid-inner">';
  1938. $output .= "<div class='avia-icongrid-icon avia-font-{$atts['font']}'>";
  1939. $output .= "<span class='icongrid-char' {$display_char}></span>";
  1940. $output .= '</div>';
  1941. $output .= '<header class="entry-content-header">';
  1942.  
  1943. if( ! empty( $atts['title'] ) )
  1944. {
  1945. $output .= "<{$title_el} class='av_icongrid_title icongrid_title {$title_el_cls}' {$markup}>" . esc_html( $atts['title'] ). "</{$title_el}>";
  1946. }
  1947. if( ! empty( $atts['subtitle'] ) )
  1948. {
  1949. $output .= "<{$subtitle_el} class='av_icongrid_subtitle icongrid_subtitle' {$markup_sub}>" . esc_html( $atts['subtitle'] ) . "</{$subtitle_el}>";
  1950. }
  1951.  
  1952. $output .= '</header>';
  1953. $output .= '</div>';
  1954. $output .= '</div>';
  1955. $output .= '<div class="avia-icongrid-content">';
  1956. $output .= '<div class="avia-icongrid-inner">';
  1957. $output .= "<div class='avia-icongrid-text' {$markup_text}>";
  1958. $output .= ShortcodeHelper::avia_apply_autop( ShortcodeHelper::avia_remove_autop( $content ) );
  1959. $output .= '</div>';
  1960. $output .= '</div>';
  1961. $output .= '</div>';
  1962. $output .= '</article>';
  1963. $output .= "</{$avia_icongrid_wrapper['end']}>";
  1964. $output .= '</li>';
  1965.  
  1966. return $output;
  1967. }
  1968. }
  1969.  
  1970. }
  1971.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement