| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace RenzoJohnson\Blocks\Settings\Tabs; |
| 6 |
|
| 7 |
use RenzoJohnson\Blocks\Settings\FieldDefinition; |
| 8 |
use RenzoJohnson\Blocks\Settings\FieldType; |
| 9 |
use RenzoJohnson\Blocks\Settings\Requirement; |
| 10 |
use RenzoJohnson\Blocks\Settings\SanitizerType; |
| 11 |
use RenzoJohnson\Blocks\Settings\SectionDefinition; |
| 12 |
use RenzoJohnson\Blocks\Settings\SettingDefinition; |
| 13 |
use RenzoJohnson\Blocks\Settings\TabDefinition; |
| 14 |
use RenzoJohnson\Blocks\Settings\TabProvider; |
| 15 |
|
| 16 |
\defined( 'ABSPATH' ) || exit; |
| 17 |
|
| 18 |
final class GeneralTab implements TabProvider { |
| 19 |
|
| 20 |
public function definition(): TabDefinition { |
| 21 |
return new TabDefinition( |
| 22 |
'general', |
| 23 |
\__( 'General', 'blocks' ), |
| 24 |
array( |
| 25 |
new SectionDefinition( |
| 26 |
'blocks_site_info', |
| 27 |
\__( 'Site Info', 'blocks' ), |
| 28 |
array( |
| 29 |
\__( 'Configure site branding and identity settings.', 'blocks' ), |
| 30 |
), |
| 31 |
array( |
| 32 |
new FieldDefinition( |
| 33 |
'blocks_favicon', |
| 34 |
\__( 'Favicon', 'blocks' ), |
| 35 |
'', |
| 36 |
FieldType::Image, |
| 37 |
array( |
| 38 |
new SettingDefinition( 'blocks_favicon', 'integer', 0, SanitizerType::AbsoluteInteger, sensitive: false, exportable: true, public_token: 'favicon_url' ), |
| 39 |
), |
| 40 |
array(), |
| 41 |
Requirement::Always, |
| 42 |
), |
| 43 |
new FieldDefinition( |
| 44 |
'blocks_logo', |
| 45 |
\__( 'Logo', 'blocks' ), |
| 46 |
'', |
| 47 |
FieldType::Image, |
| 48 |
array( |
| 49 |
new SettingDefinition( 'blocks_logo', 'integer', 0, SanitizerType::AbsoluteInteger, sensitive: false, exportable: true, public_token: 'logo_url' ), |
| 50 |
), |
| 51 |
array(), |
| 52 |
Requirement::Always, |
| 53 |
), |
| 54 |
new FieldDefinition( |
| 55 |
'blocks_logo_inverse', |
| 56 |
\__( 'Logo Inverse', 'blocks' ), |
| 57 |
'', |
| 58 |
FieldType::Image, |
| 59 |
array( |
| 60 |
new SettingDefinition( 'blocks_logo_inverse', 'integer', 0, SanitizerType::AbsoluteInteger, sensitive: false, exportable: true, public_token: 'logo_inverse_url' ), |
| 61 |
), |
| 62 |
array(), |
| 63 |
Requirement::Always, |
| 64 |
), |
| 65 |
new FieldDefinition( |
| 66 |
'blocks_default_social_image', |
| 67 |
\__( 'Default Social Image', 'blocks' ), |
| 68 |
'', |
| 69 |
FieldType::Image, |
| 70 |
array( |
| 71 |
new SettingDefinition( 'blocks_default_social_image', 'integer', 0, SanitizerType::AbsoluteInteger, sensitive: false, exportable: true, public_token: 'social_image_url' ), |
| 72 |
), |
| 73 |
array(), |
| 74 |
Requirement::Always, |
| 75 |
), |
| 76 |
new FieldDefinition( |
| 77 |
'blocks_place_id', |
| 78 |
\__( 'Place ID', 'blocks' ), |
| 79 |
\__( 'Google Places ID for reviews and maps.', 'blocks' ), |
| 80 |
FieldType::Text, |
| 81 |
array( |
| 82 |
new SettingDefinition( 'blocks_place_id', 'string', '', SanitizerType::Text, sensitive: false, exportable: true, public_token: 'place_id' ), |
| 83 |
), |
| 84 |
array(), |
| 85 |
Requirement::Always, |
| 86 |
), |
| 87 |
new FieldDefinition( |
| 88 |
'blocks_site_title', |
| 89 |
\__( 'Site Title', 'blocks' ), |
| 90 |
\__( 'Site title for branding.', 'blocks' ), |
| 91 |
FieldType::Text, |
| 92 |
array( |
| 93 |
new SettingDefinition( 'blocks_site_title', 'string', '', SanitizerType::Text, sensitive: false, exportable: true, public_token: 'site_title' ), |
| 94 |
), |
| 95 |
array(), |
| 96 |
Requirement::Always, |
| 97 |
), |
| 98 |
new FieldDefinition( |
| 99 |
'blocks_tagline', |
| 100 |
\__( 'Tagline', 'blocks' ), |
| 101 |
\__( 'Site tagline or slogan.', 'blocks' ), |
| 102 |
FieldType::Text, |
| 103 |
array( |
| 104 |
new SettingDefinition( 'blocks_tagline', 'string', '', SanitizerType::Text, sensitive: false, exportable: true, public_token: 'tagline' ), |
| 105 |
), |
| 106 |
array(), |
| 107 |
Requirement::Always, |
| 108 |
), |
| 109 |
), |
| 110 |
false, |
| 111 |
), |
| 112 |
new SectionDefinition( |
| 113 |
'blocks_contact_info', |
| 114 |
\__( 'Contact Info', 'blocks' ), |
| 115 |
array( |
| 116 |
\__( 'Enter your company contact information. This data can be used in your blocks.', 'blocks' ), |
| 117 |
), |
| 118 |
array( |
| 119 |
new FieldDefinition( |
| 120 |
'blocks_company_name', |
| 121 |
\__( 'Business Name', 'blocks' ), |
| 122 |
\__( 'Your company or business name.', 'blocks' ), |
| 123 |
FieldType::Text, |
| 124 |
array( |
| 125 |
new SettingDefinition( 'blocks_company_name', 'string', '', SanitizerType::Text, sensitive: false, exportable: true, public_token: 'company_name' ), |
| 126 |
), |
| 127 |
array(), |
| 128 |
Requirement::Always, |
| 129 |
), |
| 130 |
new FieldDefinition( |
| 131 |
'blocks_email', |
| 132 |
\__( 'Contact Email', 'blocks' ), |
| 133 |
\__( 'Contact email address.', 'blocks' ), |
| 134 |
FieldType::Text, |
| 135 |
array( |
| 136 |
new SettingDefinition( 'blocks_email', 'string', '', SanitizerType::Email, sensitive: false, exportable: true, public_token: 'email' ), |
| 137 |
), |
| 138 |
array( 'type' => 'email' ), |
| 139 |
Requirement::Always, |
| 140 |
), |
| 141 |
new FieldDefinition( |
| 142 |
'blocks_phone', |
| 143 |
\__( 'Phone Number', 'blocks' ), |
| 144 |
\__( 'Contact phone number.', 'blocks' ), |
| 145 |
FieldType::Text, |
| 146 |
array( |
| 147 |
new SettingDefinition( 'blocks_phone', 'string', '', SanitizerType::Text, sensitive: false, exportable: true, public_token: 'phone' ), |
| 148 |
), |
| 149 |
array( 'type' => 'tel' ), |
| 150 |
Requirement::Always, |
| 151 |
), |
| 152 |
new FieldDefinition( |
| 153 |
'blocks_address', |
| 154 |
\__( 'Address', 'blocks' ), |
| 155 |
\__( 'Physical address or location.', 'blocks' ), |
| 156 |
FieldType::Textarea, |
| 157 |
array( |
| 158 |
new SettingDefinition( 'blocks_address', 'string', '', SanitizerType::Textarea, sensitive: false, exportable: true, public_token: 'address' ), |
| 159 |
), |
| 160 |
array(), |
| 161 |
Requirement::Always, |
| 162 |
), |
| 163 |
), |
| 164 |
false, |
| 165 |
), |
| 166 |
new SectionDefinition( |
| 167 |
'blocks_social_media', |
| 168 |
\__( 'Social Media', 'blocks' ), |
| 169 |
array( |
| 170 |
\__( 'Add your social media profile URLs.', 'blocks' ), |
| 171 |
), |
| 172 |
array( |
| 173 |
new FieldDefinition( |
| 174 |
'blocks_facebook', |
| 175 |
\__( 'Facebook', 'blocks' ), |
| 176 |
\__( 'Facebook page URL.', 'blocks' ), |
| 177 |
FieldType::Text, |
| 178 |
array( |
| 179 |
new SettingDefinition( 'blocks_facebook', 'string', '', SanitizerType::Url, sensitive: false, exportable: true, public_token: 'facebook' ), |
| 180 |
), |
| 181 |
array( 'type' => 'url' ), |
| 182 |
Requirement::Always, |
| 183 |
), |
| 184 |
new FieldDefinition( |
| 185 |
'blocks_twitter', |
| 186 |
\__( 'Twitter / X', 'blocks' ), |
| 187 |
\__( 'Twitter/X profile URL.', 'blocks' ), |
| 188 |
FieldType::Text, |
| 189 |
array( |
| 190 |
new SettingDefinition( 'blocks_twitter', 'string', '', SanitizerType::Url, sensitive: false, exportable: true, public_token: 'twitter' ), |
| 191 |
), |
| 192 |
array( 'type' => 'url' ), |
| 193 |
Requirement::Always, |
| 194 |
), |
| 195 |
new FieldDefinition( |
| 196 |
'blocks_instagram', |
| 197 |
\__( 'Instagram', 'blocks' ), |
| 198 |
\__( 'Instagram profile URL.', 'blocks' ), |
| 199 |
FieldType::Text, |
| 200 |
array( |
| 201 |
new SettingDefinition( 'blocks_instagram', 'string', '', SanitizerType::Url, sensitive: false, exportable: true, public_token: 'instagram' ), |
| 202 |
), |
| 203 |
array( 'type' => 'url' ), |
| 204 |
Requirement::Always, |
| 205 |
), |
| 206 |
new FieldDefinition( |
| 207 |
'blocks_linkedin', |
| 208 |
\__( 'LinkedIn', 'blocks' ), |
| 209 |
\__( 'LinkedIn company or profile URL.', 'blocks' ), |
| 210 |
FieldType::Text, |
| 211 |
array( |
| 212 |
new SettingDefinition( 'blocks_linkedin', 'string', '', SanitizerType::Url, sensitive: false, exportable: true, public_token: 'linkedin' ), |
| 213 |
), |
| 214 |
array( 'type' => 'url' ), |
| 215 |
Requirement::Always, |
| 216 |
), |
| 217 |
new FieldDefinition( |
| 218 |
'blocks_youtube', |
| 219 |
\__( 'YouTube', 'blocks' ), |
| 220 |
\__( 'YouTube channel URL.', 'blocks' ), |
| 221 |
FieldType::Text, |
| 222 |
array( |
| 223 |
new SettingDefinition( 'blocks_youtube', 'string', '', SanitizerType::Url, sensitive: false, exportable: true, public_token: 'youtube' ), |
| 224 |
), |
| 225 |
array( 'type' => 'url' ), |
| 226 |
Requirement::Always, |
| 227 |
), |
| 228 |
new FieldDefinition( |
| 229 |
'blocks_variables_everywhere', |
| 230 |
\__( 'Variable Resolution', 'blocks' ), |
| 231 |
\__( 'Resolve these public tokens in regular post content, widgets, and supported page-builder output in addition to Blocks content.', 'blocks' ), |
| 232 |
FieldType::Checkbox, |
| 233 |
array( |
| 234 |
new SettingDefinition( 'blocks_variables_everywhere', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ), |
| 235 |
), |
| 236 |
array(), |
| 237 |
Requirement::Always, |
| 238 |
), |
| 239 |
), |
| 240 |
false, |
| 241 |
), |
| 242 |
), |
| 243 |
Requirement::Always, |
| 244 |
); |
| 245 |
} |
| 246 |
} |
| 247 |
|