vamtam-heading.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <?php
  2. /**
  3. * @class VamtamHeadingModule
  4. */
  5. class VamtamHeadingModule extends FLBuilderModule {
  6. /**
  7. * @method __construct
  8. */
  9. public function __construct() {
  10. $path = trailingslashit( 'modules/' . basename( dirname( __FILE__ ) ) );
  11. parent::__construct(array(
  12. 'name' => esc_html__( 'Heading', 'vamtam-elements-b' ),
  13. 'description' => esc_html__( 'Display a title/page heading.', 'vamtam-elements-b' ),
  14. 'category' => esc_html__( 'VamTam Modules', 'vamtam-elements-b' ),
  15. 'partial_refresh' => true,
  16. 'dir' => VAMTAMEL_B_DIR . $path,
  17. 'url' => VAMTAMEL_B_URL . $path,
  18. ));
  19. }
  20. }
  21. /**
  22. * Register the module and its form settings.
  23. */
  24. FLBuilder::register_module('VamtamHeadingModule', array(
  25. 'general' => array(
  26. 'title' => esc_html__( 'General', 'vamtam-elements-b' ),
  27. 'sections' => array(
  28. 'general' => array(
  29. 'title' => '',
  30. 'fields' => array(
  31. 'heading' => array(
  32. 'type' => 'text',
  33. 'label' => esc_html__( 'Heading', 'vamtam-elements-b' ),
  34. 'default' => '',
  35. 'preview' => array(
  36. 'type' => 'text',
  37. 'selector' => '.vamtam-heading-text',
  38. ),
  39. ),
  40. ),
  41. ),
  42. 'link' => array(
  43. 'title' => esc_html__( 'Link', 'vamtam-elements-b' ),
  44. 'fields' => array(
  45. 'link' => array(
  46. 'type' => 'link',
  47. 'label' => esc_html__( 'Link', 'vamtam-elements-b' ),
  48. 'preview' => array(
  49. 'type' => 'none',
  50. ),
  51. ),
  52. 'link_target' => array(
  53. 'type' => 'select',
  54. 'label' => esc_html__( 'Link Target', 'vamtam-elements-b' ),
  55. 'default' => '_self',
  56. 'options' => array(
  57. '_self' => esc_html__( 'Same Window', 'vamtam-elements-b' ),
  58. '_blank' => esc_html__( 'New Window', 'vamtam-elements-b' ),
  59. ),
  60. 'preview' => array(
  61. 'type' => 'none',
  62. ),
  63. ),
  64. ),
  65. ),
  66. ),
  67. ),
  68. 'style' => array(
  69. 'title' => esc_html__( 'Style', 'vamtam-elements-b' ),
  70. 'sections' => array(
  71. 'colors' => array(
  72. 'title' => esc_html__( 'Colors', 'vamtam-elements-b' ),
  73. 'fields' => array(
  74. 'color' => array(
  75. 'type' => 'vamtam-color',
  76. 'label' => esc_html__( 'Text Color', 'vamtam-elements-b' ),
  77. ),
  78. ),
  79. ),
  80. 'structure' => array(
  81. 'title' => esc_html__( 'Structure', 'vamtam-elements-b' ),
  82. 'fields' => array(
  83. 'with_divider' => array(
  84. 'type' => 'select',
  85. 'label' => esc_html__( 'Divider', 'vamtam-elements-b' ),
  86. 'default' => 'off',
  87. 'options' => array(
  88. 'on' => esc_html__( 'On', 'vamtam-elements-b' ),
  89. 'off' => esc_html__( 'Off', 'vamtam-elements-b' ),
  90. ),
  91. ),
  92. 'alignment' => array(
  93. 'type' => 'select',
  94. 'label' => esc_html__( 'Alignment', 'vamtam-elements-b' ),
  95. 'default' => 'left',
  96. 'options' => array(
  97. 'left' => esc_html__( 'Left', 'vamtam-elements-b' ),
  98. 'center' => esc_html__( 'Center', 'vamtam-elements-b' ),
  99. 'right' => esc_html__( 'Right', 'vamtam-elements-b' ),
  100. ),
  101. ),
  102. 'tag' => array(
  103. 'type' => 'select',
  104. 'label' => esc_html__( 'HTML Tag', 'vamtam-elements-b' ),
  105. 'default' => 'h3',
  106. 'options' => array(
  107. 'h1' => 'h1',
  108. 'h2' => 'h2',
  109. 'h3' => 'h3',
  110. 'h4' => 'h4',
  111. 'h5' => 'h5',
  112. 'h6' => 'h6',
  113. ),
  114. ),
  115. 'style_base' => array(
  116. 'type' => 'select',
  117. 'label' => esc_html__( 'Style Base', 'vamtam-elements-b' ),
  118. 'default' => 'tag',
  119. 'options' => array(
  120. 'tag' => esc_html__( 'From HTML tag', 'vamtam-elements-b' ),
  121. 'style-1' => esc_html__( 'Additional Font Style 1', 'vamtam-elements-b' ),
  122. 'style-2' => esc_html__( 'Additional Font Style 2', 'vamtam-elements-b' ),
  123. ),
  124. ),
  125. 'font' => array(
  126. 'type' => 'font',
  127. 'default' => array(
  128. 'family' => 'Default',
  129. 'weight' => 300,
  130. ),
  131. 'label' => esc_html__( 'Font', 'vamtam-elements-b' ),
  132. 'preview' => array(
  133. 'type' => 'font',
  134. 'selector' => '.vamtam-heading-text',
  135. ),
  136. ),
  137. 'font_size' => array(
  138. 'type' => 'select',
  139. 'label' => esc_html__( 'Font Size', 'vamtam-elements-b' ),
  140. 'default' => 'default',
  141. 'options' => array(
  142. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  143. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  144. ),
  145. 'toggle' => array(
  146. 'custom' => array(
  147. 'fields' => array( 'custom_font_size' ),
  148. ),
  149. ),
  150. ),
  151. 'custom_font_size' => array(
  152. 'type' => 'text',
  153. 'label' => esc_html__( 'Custom Font Size', 'vamtam-elements-b' ),
  154. 'default' => '24',
  155. 'maxlength' => '3',
  156. 'size' => '4',
  157. 'description' => 'px',
  158. ),
  159. 'line_height' => array(
  160. 'type' => 'select',
  161. 'label' => esc_html__( 'Line Height', 'vamtam-elements-b' ),
  162. 'default' => 'default',
  163. 'options' => array(
  164. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  165. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  166. ),
  167. 'toggle' => array(
  168. 'custom' => array(
  169. 'fields' => array( 'custom_line_height' ),
  170. ),
  171. ),
  172. ),
  173. 'custom_line_height' => array(
  174. 'type' => 'text',
  175. 'label' => esc_html__( 'Custom Line Height', 'vamtam-elements-b' ),
  176. 'default' => '1.4',
  177. 'maxlength' => '4',
  178. 'size' => '4',
  179. 'description' => 'em',
  180. ),
  181. 'letter_spacing' => array(
  182. 'type' => 'select',
  183. 'label' => esc_html__( 'Letter Spacing', 'vamtam-elements-b' ),
  184. 'default' => 'default',
  185. 'options' => array(
  186. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  187. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  188. ),
  189. 'toggle' => array(
  190. 'custom' => array(
  191. 'fields' => array( 'custom_letter_spacing' ),
  192. ),
  193. ),
  194. ),
  195. 'custom_letter_spacing' => array(
  196. 'type' => 'text',
  197. 'label' => esc_html__( 'Custom Letter Spacing', 'vamtam-elements-b' ),
  198. 'default' => '0',
  199. 'maxlength' => '3',
  200. 'size' => '4',
  201. 'description' => 'px',
  202. ),
  203. ),
  204. ),
  205. 'r_structure' => array(
  206. 'title' => esc_html__( 'Mobile Structure', 'vamtam-elements-b' ),
  207. 'fields' => array(
  208. 'r_alignment' => array(
  209. 'type' => 'select',
  210. 'label' => esc_html__( 'Alignment', 'vamtam-elements-b' ),
  211. 'default' => 'default',
  212. 'options' => array(
  213. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  214. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  215. ),
  216. 'toggle' => array(
  217. 'custom' => array(
  218. 'fields' => array( 'r_custom_alignment' ),
  219. ),
  220. ),
  221. 'preview' => array(
  222. 'type' => 'none',
  223. ),
  224. ),
  225. 'r_custom_alignment' => array(
  226. 'type' => 'select',
  227. 'label' => esc_html__( 'Custom Alignment', 'vamtam-elements-b' ),
  228. 'default' => 'center',
  229. 'options' => array(
  230. 'left' => esc_html__( 'Left', 'vamtam-elements-b' ),
  231. 'center' => esc_html__( 'Center', 'vamtam-elements-b' ),
  232. 'right' => esc_html__( 'Right', 'vamtam-elements-b' ),
  233. ),
  234. 'preview' => array(
  235. 'type' => 'none',
  236. ),
  237. ),
  238. 'r_font_size' => array(
  239. 'type' => 'select',
  240. 'label' => esc_html__( 'Font Size', 'vamtam-elements-b' ),
  241. 'default' => 'default',
  242. 'options' => array(
  243. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  244. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  245. ),
  246. 'toggle' => array(
  247. 'custom' => array(
  248. 'fields' => array( 'r_custom_font_size' ),
  249. ),
  250. ),
  251. 'preview' => array(
  252. 'type' => 'none',
  253. ),
  254. ),
  255. 'r_custom_font_size' => array(
  256. 'type' => 'text',
  257. 'label' => esc_html__( 'Custom Font Size', 'vamtam-elements-b' ),
  258. 'default' => '24',
  259. 'maxlength' => '3',
  260. 'size' => '4',
  261. 'description' => 'px',
  262. 'preview' => array(
  263. 'type' => 'none',
  264. ),
  265. ),
  266. 'r_line_height' => array(
  267. 'type' => 'select',
  268. 'label' => esc_html__( 'Line Height', 'vamtam-elements-b' ),
  269. 'default' => 'default',
  270. 'options' => array(
  271. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  272. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  273. ),
  274. 'toggle' => array(
  275. 'custom' => array(
  276. 'fields' => array( 'r_custom_line_height' ),
  277. ),
  278. ),
  279. ),
  280. 'r_custom_line_height' => array(
  281. 'type' => 'text',
  282. 'label' => esc_html__( 'Custom Line Height', 'vamtam-elements-b' ),
  283. 'default' => '1.4',
  284. 'maxlength' => '4',
  285. 'size' => '4',
  286. ),
  287. 'r_letter_spacing' => array(
  288. 'type' => 'select',
  289. 'label' => esc_html__( 'Letter Spacing', 'vamtam-elements-b' ),
  290. 'default' => 'default',
  291. 'options' => array(
  292. 'default' => esc_html__( 'Default', 'vamtam-elements-b' ),
  293. 'custom' => esc_html__( 'Custom', 'vamtam-elements-b' ),
  294. ),
  295. 'toggle' => array(
  296. 'custom' => array(
  297. 'fields' => array( 'r_custom_letter_spacing' ),
  298. ),
  299. ),
  300. ),
  301. 'r_custom_letter_spacing' => array(
  302. 'type' => 'text',
  303. 'label' => esc_html__( 'Custom Letter Spacing', 'vamtam-elements-b' ),
  304. 'default' => '0',
  305. 'maxlength' => '3',
  306. 'size' => '4',
  307. 'description' => 'px',
  308. ),
  309. ),
  310. ),
  311. ),
  312. ),
  313. ));