blocks
2 years ago
class-do-css.php
2 years ago
class-dynamic-content.php
2 years ago
class-enqueue-css.php
3 years ago
class-legacy-attributes.php
4 years ago
class-map-deprecated-attributes.php
2 years ago
class-plugin-update.php
5 years ago
class-query-loop.php
3 years ago
class-render-blocks.php
3 years ago
class-rest.php
2 years ago
class-settings.php
4 years ago
dashboard.php
3 years ago
defaults.php
2 years ago
functions.php
2 years ago
general.php
2 years ago
defaults.php
177 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Set our block attribute defaults. |
| 4 | * |
| 5 | * @package GenerateBlocks |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly. |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Set our block defaults. |
| 14 | * |
| 15 | * @since 0.1 |
| 16 | * |
| 17 | * @return array |
| 18 | */ |
| 19 | function generateblocks_get_block_defaults() { |
| 20 | return apply_filters( |
| 21 | 'generateblocks_defaults', |
| 22 | [ |
| 23 | 'container' => generateblocks_with_global_defaults( GenerateBlocks_Block_Container::defaults() ), |
| 24 | 'buttonContainer' => generateblocks_with_global_defaults( GenerateBlocks_Block_Button_Container::defaults() ), |
| 25 | 'button' => generateblocks_with_global_defaults( GenerateBlocks_Block_Button::defaults() ), |
| 26 | 'gridContainer' => generateblocks_with_global_defaults( GenerateBlocks_Block_Grid::defaults() ), |
| 27 | 'headline' => generateblocks_with_global_defaults( GenerateBlocks_Block_Headline::defaults() ), |
| 28 | 'image' => generateblocks_with_global_defaults( GenerateBlocks_Block_Image::defaults() ), |
| 29 | ] |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Get defaults for our general options. |
| 35 | * |
| 36 | * @since 0.1 |
| 37 | */ |
| 38 | function generateblocks_get_option_defaults() { |
| 39 | return apply_filters( |
| 40 | 'generateblocks_option_defaults', |
| 41 | array( |
| 42 | 'container_width' => 1100, |
| 43 | 'css_print_method' => 'file', |
| 44 | 'sync_responsive_previews' => true, |
| 45 | 'disable_google_fonts' => false, |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Styles to use in the editor/font-end when needed. |
| 52 | * |
| 53 | * @since 1.0 |
| 54 | */ |
| 55 | function generateblocks_get_default_styles() { |
| 56 | $defaults = generateblocks_get_block_defaults(); |
| 57 | |
| 58 | $defaultBlockStyles = array( |
| 59 | 'button' => array( |
| 60 | 'backgroundColor' => $defaults['button']['backgroundColor'] ? $defaults['button']['backgroundColor'] : '#0366d6', |
| 61 | 'textColor' => $defaults['button']['textColor'] ? $defaults['button']['textColor'] : '#ffffff', |
| 62 | 'backgroundColorHover' => $defaults['button']['backgroundColorHover'] ? $defaults['button']['backgroundColorHover'] : '#222222', |
| 63 | 'textColorHover' => $defaults['button']['textColorHover'] ? $defaults['button']['textColorHover'] : '#ffffff', |
| 64 | 'spacing' => [ |
| 65 | 'paddingTop' => $defaults['button']['paddingTop'] ? $defaults['button']['paddingTop'] : '15px', |
| 66 | 'paddingRight' => $defaults['button']['paddingRight'] ? $defaults['button']['paddingRight'] : '20px', |
| 67 | 'paddingBottom' => $defaults['button']['paddingBottom'] ? $defaults['button']['paddingBottom'] : '15px', |
| 68 | 'paddingLeft' => $defaults['button']['paddingLeft'] ? $defaults['button']['paddingLeft'] : '20px', |
| 69 | ], |
| 70 | 'display' => 'inline-flex', |
| 71 | ), |
| 72 | 'container' => array( |
| 73 | 'gridItemPaddingTop' => '', |
| 74 | 'gridItemPaddingRight' => '', |
| 75 | 'gridItemPaddingBottom' => '', |
| 76 | 'gridItemPaddingLeft' => '', |
| 77 | 'bgImageSize' => 'full', |
| 78 | 'shapeDividers' => array( |
| 79 | 'shape' => 'gb-waves-1', |
| 80 | 'location' => 'bottom', |
| 81 | 'height' => 200, |
| 82 | 'heightTablet' => '', |
| 83 | 'heightMobile' => '', |
| 84 | 'width' => 100, |
| 85 | 'widthTablet' => '', |
| 86 | 'widthMobile' => '', |
| 87 | 'flipHorizontally' => false, |
| 88 | 'zindex' => '', |
| 89 | 'color' => '#000000', |
| 90 | 'colorOpacity' => 1, |
| 91 | ), |
| 92 | ), |
| 93 | ); |
| 94 | |
| 95 | if ( function_exists( 'generate_get_default_fonts' ) ) { |
| 96 | $font_settings = wp_parse_args( |
| 97 | get_option( 'generate_settings', array() ), |
| 98 | generate_get_default_fonts() |
| 99 | ); |
| 100 | |
| 101 | $defaultBlockStyles['headline'] = array( |
| 102 | 'p' => array( |
| 103 | 'marginBottom' => $font_settings['paragraph_margin'], |
| 104 | 'marginBottomTablet' => '', |
| 105 | 'marginBottomMobile' => '', |
| 106 | 'marginUnit' => 'em', |
| 107 | 'fontSize' => $font_settings['body_font_size'], |
| 108 | 'fontSizeTablet' => '', |
| 109 | 'fontSizeMobile' => '', |
| 110 | 'fontSizeUnit' => 'px', |
| 111 | ), |
| 112 | 'h1' => array( |
| 113 | 'marginBottom' => $font_settings['heading_1_margin_bottom'], |
| 114 | 'marginBottomTablet' => '', |
| 115 | 'marginBottomMobile' => '', |
| 116 | 'marginUnit' => 'px', |
| 117 | 'fontSize' => $font_settings['heading_1_font_size'], |
| 118 | 'fontSizeTablet' => '', |
| 119 | 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'], |
| 120 | 'fontSizeUnit' => 'px', |
| 121 | ), |
| 122 | 'h2' => array( |
| 123 | 'marginBottom' => $font_settings['heading_2_margin_bottom'], |
| 124 | 'marginBottomTablet' => '', |
| 125 | 'marginBottomMobile' => '', |
| 126 | 'marginUnit' => 'px', |
| 127 | 'fontSize' => $font_settings['heading_2_font_size'], |
| 128 | 'fontSizeTablet' => '', |
| 129 | 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'], |
| 130 | 'fontSizeUnit' => 'px', |
| 131 | ), |
| 132 | 'h3' => array( |
| 133 | 'marginBottom' => $font_settings['heading_3_margin_bottom'], |
| 134 | 'marginBottomTablet' => '', |
| 135 | 'marginBottomMobile' => '', |
| 136 | 'marginUnit' => 'px', |
| 137 | 'fontSize' => $font_settings['heading_3_font_size'], |
| 138 | 'fontSizeTablet' => '', |
| 139 | 'fontSizeMobile' => '', |
| 140 | 'fontSizeUnit' => 'px', |
| 141 | ), |
| 142 | 'h4' => array( |
| 143 | 'marginBottom' => '20', |
| 144 | 'marginBottomTablet' => '', |
| 145 | 'marginBottomMobile' => '', |
| 146 | 'marginUnit' => 'px', |
| 147 | 'fontSize' => '', |
| 148 | 'fontSizeTablet' => '', |
| 149 | 'fontSizeMobile' => '', |
| 150 | 'fontSizeUnit' => 'px', |
| 151 | ), |
| 152 | 'h5' => array( |
| 153 | 'marginBottom' => '20', |
| 154 | 'marginBottomTablet' => '', |
| 155 | 'marginBottomMobile' => '', |
| 156 | 'marginUnit' => 'px', |
| 157 | 'fontSize' => '', |
| 158 | 'fontSizeTablet' => '', |
| 159 | 'fontSizeMobile' => '', |
| 160 | 'fontSizeUnit' => 'px', |
| 161 | ), |
| 162 | 'h6' => array( |
| 163 | 'marginBottom' => '20', |
| 164 | 'marginBottomTablet' => '', |
| 165 | 'marginBottomMobile' => '', |
| 166 | 'marginUnit' => 'px', |
| 167 | 'fontSize' => '', |
| 168 | 'fontSizeTablet' => '', |
| 169 | 'fontSizeMobile' => '', |
| 170 | 'fontSizeUnit' => 'px', |
| 171 | ), |
| 172 | ); |
| 173 | } |
| 174 | |
| 175 | return apply_filters( 'generateblocks_default_block_styles', $defaultBlockStyles ); |
| 176 | } |
| 177 |