vc-custom-heading-element.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. function vc_custom_heading_element_params() {
  6. return array(
  7. 'name' => esc_html__( 'Custom Heading', 'js_composer' ),
  8. 'base' => 'vc_custom_heading',
  9. 'icon' => 'icon-wpb-ui-custom_heading',
  10. 'show_settings_on_create' => true,
  11. 'category' => esc_html__( 'Content', 'js_composer' ),
  12. 'description' => esc_html__( 'Text with Google fonts', 'js_composer' ),
  13. 'params' => array(
  14. array(
  15. 'type' => 'dropdown',
  16. 'heading' => esc_html__( 'Text source', 'js_composer' ),
  17. 'param_name' => 'source',
  18. 'value' => array(
  19. esc_html__( 'Custom text', 'js_composer' ) => '',
  20. esc_html__( 'Post or Page Title', 'js_composer' ) => 'post_title',
  21. ),
  22. 'std' => '',
  23. 'description' => esc_html__( 'Select text source.', 'js_composer' ),
  24. ),
  25. array(
  26. 'type' => 'textarea',
  27. 'heading' => esc_html__( 'Text', 'js_composer' ),
  28. 'param_name' => 'text',
  29. 'admin_label' => true,
  30. 'value' => esc_html__( 'This is custom heading element', 'js_composer' ),
  31. 'description' => esc_html__( 'Note: If you are using non-latin characters be sure to activate them under Settings/WPBakery Page Builder/General Settings.', 'js_composer' ),
  32. 'dependency' => array(
  33. 'element' => 'source',
  34. 'is_empty' => true,
  35. ),
  36. ),
  37. array(
  38. 'type' => 'vc_link',
  39. 'heading' => esc_html__( 'URL (Link)', 'js_composer' ),
  40. 'param_name' => 'link',
  41. 'description' => esc_html__( 'Add link to custom heading.', 'js_composer' ),
  42. // compatible with btn2 and converted from href{btn1}
  43. ),
  44. array(
  45. 'type' => 'font_container',
  46. 'param_name' => 'font_container',
  47. 'value' => 'tag:h2|text_align:left',
  48. 'settings' => array(
  49. 'fields' => array(
  50. 'tag' => 'h2',
  51. // default value h2
  52. 'text_align',
  53. 'font_size',
  54. 'line_height',
  55. 'color',
  56. 'tag_description' => esc_html__( 'Select element tag.', 'js_composer' ),
  57. 'text_align_description' => esc_html__( 'Select text alignment.', 'js_composer' ),
  58. 'font_size_description' => esc_html__( 'Enter font size.', 'js_composer' ),
  59. 'line_height_description' => esc_html__( 'Enter line height.', 'js_composer' ),
  60. 'color_description' => esc_html__( 'Select heading color.', 'js_composer' ),
  61. ),
  62. ),
  63. ),
  64. array(
  65. 'type' => 'checkbox',
  66. 'heading' => esc_html__( 'Use theme default font family?', 'js_composer' ),
  67. 'param_name' => 'use_theme_fonts',
  68. 'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
  69. 'description' => esc_html__( 'Use font family from the theme.', 'js_composer' ),
  70. ),
  71. array(
  72. 'type' => 'google_fonts',
  73. 'param_name' => 'google_fonts',
  74. 'value' => 'font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal',
  75. 'settings' => array(
  76. 'fields' => array(
  77. 'font_family_description' => esc_html__( 'Select font family.', 'js_composer' ),
  78. 'font_style_description' => esc_html__( 'Select font styling.', 'js_composer' ),
  79. ),
  80. ),
  81. 'dependency' => array(
  82. 'element' => 'use_theme_fonts',
  83. 'value_not_equal_to' => 'yes',
  84. ),
  85. ),
  86. vc_map_add_css_animation(),
  87. array(
  88. 'type' => 'el_id',
  89. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  90. 'param_name' => 'el_id',
  91. '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>' ),
  92. ),
  93. array(
  94. 'type' => 'textfield',
  95. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  96. 'param_name' => 'el_class',
  97. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  98. ),
  99. array(
  100. 'type' => 'css_editor',
  101. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  102. 'param_name' => 'css',
  103. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  104. ),
  105. ),
  106. );
  107. }