CTF_Builder_Customizer_Tab.php
1 month ago
CTF_Customize_Tab.php
1 month ago
CTF_Settings_Tab.php
1 month ago
CTF_Styling_Tab.php
1 month ago
CTF_Styling_Tab.php
486 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Styling Tab |
| 4 | * Contains different controls for the individual Elements |
| 5 | * |
| 6 | * @since 2.0 |
| 7 | */ |
| 8 | namespace TwitterFeed\Builder\Tabs; |
| 9 | |
| 10 | if(!defined('ABSPATH')) exit; |
| 11 | |
| 12 | class CTF_Styling_Tab{ |
| 13 | |
| 14 | /** |
| 15 | * |
| 16 | * @since 2.0 |
| 17 | * @return array |
| 18 | */ |
| 19 | static function post_styling_author(){ |
| 20 | return [ |
| 21 | [ |
| 22 | 'type' => 'separator', |
| 23 | 'top' => 20, |
| 24 | 'bottom' => 10, |
| 25 | ], |
| 26 | [ |
| 27 | 'type' => 'switcher', |
| 28 | 'id' => 'include_avatar', |
| 29 | 'label' => __( 'Avatar Image', 'custom-twitter-feeds' ), |
| 30 | 'reverse' => 'true', |
| 31 | 'stacked' => 'true', |
| 32 | 'labelStrong' => 'true', |
| 33 | 'options' => [ |
| 34 | 'enabled' => true, |
| 35 | 'disabled' => false |
| 36 | ] |
| 37 | ], |
| 38 | [ |
| 39 | 'type' => 'separator', |
| 40 | 'top' => 10, |
| 41 | 'bottom' => 10, |
| 42 | ], |
| 43 | [ |
| 44 | 'type' => 'switcher', |
| 45 | 'id' => 'include_author_text', |
| 46 | 'label' => __( 'Author Text', 'custom-twitter-feeds' ), |
| 47 | 'reverse' => 'true', |
| 48 | 'stacked' => 'true', |
| 49 | 'labelStrong' => 'true', |
| 50 | 'options' => [ |
| 51 | 'enabled' => true, |
| 52 | 'disabled' => false |
| 53 | ] |
| 54 | ], |
| 55 | [ |
| 56 | 'type' => 'select', |
| 57 | 'id' => 'authortextsize', |
| 58 | 'layout' => 'half', |
| 59 | 'child' => true, |
| 60 | 'conditionHide' => true, |
| 61 | 'strongHeading' => 'false', |
| 62 | 'heading' => __( 'Size', 'custom-twitter-feeds' ), |
| 63 | 'condition' => ['include_author_text' => [true]], |
| 64 | 'stacked' => 'true', |
| 65 | 'style' => ['.ctf-author-name' => 'font-size:{{value}}px!important;'], |
| 66 | 'options' => CTF_Builder_Customizer_Tab::get_text_size_options() |
| 67 | ], |
| 68 | [ |
| 69 | 'type' => 'colorpicker', |
| 70 | 'id' => 'authortextcolor', |
| 71 | 'condition' => ['include_author_text' => [true]], |
| 72 | 'conditionHide' => true, |
| 73 | 'layout' => 'half', |
| 74 | 'strongHeading' => 'false', |
| 75 | 'child' => true, |
| 76 | 'heading' => __( 'Color', 'custom-twitter-feeds' ), |
| 77 | 'style' => ['.ctf-author-name' => 'color:{{value}}!important;'], |
| 78 | 'stacked' => 'true' |
| 79 | ], |
| 80 | ]; |
| 81 | } |
| 82 | /** |
| 83 | * |
| 84 | * @since 2.0 |
| 85 | * @return array |
| 86 | */ |
| 87 | static function post_styling_tweet_text(){ |
| 88 | return [ |
| 89 | [ |
| 90 | 'type' => 'separator', |
| 91 | 'top' => 20, |
| 92 | 'bottom' => 10, |
| 93 | ], |
| 94 | [ |
| 95 | 'type' => 'heading', |
| 96 | 'heading' => __( 'Text', 'custom-twitter-feeds' ), |
| 97 | ], |
| 98 | [ |
| 99 | 'type' => 'select', |
| 100 | 'id' => 'tweettextsize', |
| 101 | 'layout' => 'half', |
| 102 | 'strongHeading' => 'false', |
| 103 | 'heading' => __( 'Size', 'custom-twitter-feeds' ), |
| 104 | 'stacked' => 'true', |
| 105 | 'style' => ['.ctf-tweet-text' => 'font-size:{{value}}px!important;'], |
| 106 | 'options' => CTF_Builder_Customizer_Tab::get_text_size_options() |
| 107 | ], |
| 108 | [ |
| 109 | 'type' => 'colorpicker', |
| 110 | 'id' => 'textcolor', |
| 111 | 'layout' => 'half', |
| 112 | 'strongHeading' => 'false', |
| 113 | 'heading' => __( 'Color', 'custom-twitter-feeds' ), |
| 114 | 'style' => ['.ctf-tweet-text' => 'color:{{value}}!important;'], |
| 115 | 'stacked' => 'true' |
| 116 | ], |
| 117 | [ |
| 118 | 'type' => 'number', |
| 119 | 'id' => 'textlength', |
| 120 | 'fieldSuffix' => 'characters', |
| 121 | 'layout' => 'half', |
| 122 | 'strongHeading' => 'false', |
| 123 | 'heading' => __( 'Max Length', 'custom-twitter-feeds' ), |
| 124 | 'stacked' => 'true' |
| 125 | ], |
| 126 | [ |
| 127 | 'type' => 'separator', |
| 128 | 'top' => 10, |
| 129 | 'bottom' => 10, |
| 130 | ], |
| 131 | [ |
| 132 | 'type' => 'switcher', |
| 133 | 'id' => 'disablelinks', |
| 134 | 'label' => __( 'Enable links in Tweet Text', 'custom-twitter-feeds' ), |
| 135 | 'description' => __( 'If enabled, it will convert urls, hashtags and mentions into clickable links', 'custom-twitter-feeds' ), |
| 136 | 'descriptionPosition' => 'bottom', |
| 137 | 'alignDescription' => true, |
| 138 | 'reverse' => 'true', |
| 139 | 'stacked' => 'true', |
| 140 | 'labelStrong' => 'true', |
| 141 | 'options' => [ |
| 142 | 'enabled' => false, |
| 143 | 'disabled' => true |
| 144 | ] |
| 145 | ], |
| 146 | [ |
| 147 | 'type' => 'colorpicker', |
| 148 | 'id' => 'linktextcolor', |
| 149 | 'condition' => ['disablelinks' => [false]], |
| 150 | 'conditionHide' => true, |
| 151 | 'layout' => 'half', |
| 152 | 'child' => true, |
| 153 | 'strongHeading' => 'false', |
| 154 | 'heading' => __( 'Color', 'custom-twitter-feeds' ), |
| 155 | 'style' => ['.ctf-tweet-text a' => 'color:{{value}}!important;'], |
| 156 | 'stacked' => 'true' |
| 157 | ], |
| 158 | |
| 159 | [ |
| 160 | 'type' => 'separator', |
| 161 | 'top' => 10, |
| 162 | 'bottom' => 10, |
| 163 | ], |
| 164 | |
| 165 | [ |
| 166 | 'type' => 'switcher', |
| 167 | 'id' => 'linktexttotwitter', |
| 168 | 'label' => __( 'Link Tweet Text to Twitter', 'custom-twitter-feeds' ), |
| 169 | 'description' => __( 'If enabled, this links the tweet text to the original tweet on Twitter', 'custom-twitter-feeds' ), |
| 170 | 'descriptionPosition' => 'bottom', |
| 171 | 'alignDescription' => true, |
| 172 | 'reverse' => 'true', |
| 173 | 'stacked' => 'true', |
| 174 | 'labelStrong' => 'true', |
| 175 | 'options' => [ |
| 176 | 'enabled' => true, |
| 177 | 'disabled' => false |
| 178 | ] |
| 179 | ], |
| 180 | |
| 181 | ]; |
| 182 | } |
| 183 | /** |
| 184 | * |
| 185 | * @since 2.0 |
| 186 | * @return array |
| 187 | */ |
| 188 | static function post_styling_tweet_date(){ |
| 189 | return [ |
| 190 | [ |
| 191 | 'type' => 'separator', |
| 192 | 'top' => 20, |
| 193 | 'bottom' => 15, |
| 194 | ], |
| 195 | [ |
| 196 | 'type' => 'heading', |
| 197 | 'stacked' => 'true', |
| 198 | 'heading' => __( 'Format', 'custom-twitter-feeds' ), |
| 199 | ], |
| 200 | [ |
| 201 | 'type' => 'select', |
| 202 | 'id' => 'dateformat', |
| 203 | 'strongHeading' => 'false', |
| 204 | 'stacked' => 'true', |
| 205 | 'options' => CTF_Builder_Customizer_Tab::get_date_format_options() |
| 206 | ], |
| 207 | [ |
| 208 | 'type' => 'text', |
| 209 | 'id' => 'datecustom', |
| 210 | 'condition' => ['dateformat' => ['custom']], |
| 211 | 'conditionHide' => true, |
| 212 | 'stacked' => 'true', |
| 213 | 'placeholder' => 'Eg. F j, Y', |
| 214 | ], |
| 215 | [ |
| 216 | 'type' => 'heading', |
| 217 | 'stacked' => 'true', |
| 218 | 'heading' => sprintf( __( '%sLearn more about custom formats %s', 'custom-twitter-feeds' ), '<a class="sb-customizer-ctrl-link" href="https://smashballoon.com/doc/date-formatting-reference/?utm_campaign=twitter-free&utm_source=customizer&utm_medium=docs" target="_blank" rel="noopener">', '</a>' ), |
| 219 | ], |
| 220 | [ |
| 221 | 'type' => 'separator', |
| 222 | 'top' => 25, |
| 223 | 'bottom' => 5, |
| 224 | ], |
| 225 | [ |
| 226 | 'type' => 'heading', |
| 227 | 'heading' => __( 'Text', 'custom-twitter-feeds' ), |
| 228 | ], |
| 229 | [ |
| 230 | 'type' => 'select', |
| 231 | 'id' => 'datetextsize', |
| 232 | 'layout' => 'half', |
| 233 | 'strongHeading' => 'false', |
| 234 | 'heading' => __( 'Size', 'custom-twitter-feeds' ), |
| 235 | 'stacked' => 'true', |
| 236 | 'style' => ['.ctf-tweet-meta a' => 'font-size:{{value}}px!important;'], |
| 237 | 'options' => CTF_Builder_Customizer_Tab::get_text_size_options() |
| 238 | ], |
| 239 | [ |
| 240 | 'type' => 'colorpicker', |
| 241 | 'id' => 'datetextcolor', |
| 242 | 'layout' => 'half', |
| 243 | 'strongHeading' => 'false', |
| 244 | 'heading' => __( 'Color', 'custom-twitter-feeds' ), |
| 245 | 'style' => ['.ctf-tweet-meta a' => 'color:{{value}}!important;'], |
| 246 | 'stacked' => 'true' |
| 247 | ] |
| 248 | ]; |
| 249 | } |
| 250 | /** |
| 251 | * |
| 252 | * @since 2.0 |
| 253 | * @return array |
| 254 | */ |
| 255 | static function post_styling_tweet_actions(){ |
| 256 | return [ |
| 257 | [ |
| 258 | 'type' => 'separator', |
| 259 | 'top' => 20, |
| 260 | 'bottom' => 15, |
| 261 | ], |
| 262 | [ |
| 263 | 'type' => 'heading', |
| 264 | 'stacked' => 'true', |
| 265 | 'heading' => __( 'Icons', 'custom-twitter-feeds' ), |
| 266 | 'description' => __( 'Customize icons for like, retweet and reply', 'custom-twitter-feeds' ), |
| 267 | ], |
| 268 | [ |
| 269 | 'type' => 'select', |
| 270 | 'id' => 'iconsize', |
| 271 | 'layout' => 'half', |
| 272 | 'strongHeading' => 'false', |
| 273 | 'heading' => __( 'Size', 'custom-twitter-feeds' ), |
| 274 | 'stacked' => 'true', |
| 275 | 'style' => ['.ctf-tweet-actions a' => 'font-size:{{value}}px!important;'], |
| 276 | 'options' => CTF_Builder_Customizer_Tab::get_text_size_options() |
| 277 | ], |
| 278 | [ |
| 279 | 'type' => 'colorpicker', |
| 280 | 'id' => 'iconcolor', |
| 281 | 'layout' => 'half', |
| 282 | 'strongHeading' => 'false', |
| 283 | 'heading' => __( 'Color', 'custom-twitter-feeds' ), |
| 284 | 'style' => ['.ctf-tweet-actions a' => 'color:{{value}}!important;'], |
| 285 | 'stacked' => 'true' |
| 286 | ], |
| 287 | [ |
| 288 | 'type' => 'separator', |
| 289 | 'top' => 20, |
| 290 | 'bottom' => 15, |
| 291 | ], |
| 292 | [ |
| 293 | 'type' => 'switcher', |
| 294 | 'id' => 'viewtwitterlink', |
| 295 | 'label' => __( 'View on Twitter link', 'custom-twitter-feeds' ), |
| 296 | 'description' => __( 'Toggle the “Twitter” link below each tweet', 'custom-twitter-feeds' ), |
| 297 | 'descriptionPosition' => 'bottom', |
| 298 | 'reverse' => 'true', |
| 299 | 'stacked' => 'true', |
| 300 | 'labelStrong' => 'true', |
| 301 | 'options' => [ |
| 302 | 'enabled' => true, |
| 303 | 'disabled' => false |
| 304 | ] |
| 305 | ], |
| 306 | [ |
| 307 | 'type' => 'text', |
| 308 | 'id' => 'twitterlinktext', |
| 309 | 'condition' => ['viewtwitterlink' => [true]], |
| 310 | 'conditionHide' => true, |
| 311 | 'child' => true, |
| 312 | 'stacked' => true, |
| 313 | 'description' => __( 'Customize Text', 'custom-twitter-feeds' ), |
| 314 | ], |
| 315 | ]; |
| 316 | } |
| 317 | /** |
| 318 | * |
| 319 | * @since 2.0 |
| 320 | * @return array |
| 321 | */ |
| 322 | static function post_styling_quote_tweet(){ |
| 323 | return [ |
| 324 | [ |
| 325 | 'type' => 'select', |
| 326 | 'id' => 'quotedauthorsize', |
| 327 | 'layout' => 'half', |
| 328 | 'strongHeading' => 'false', |
| 329 | 'heading' => __( 'Size', 'custom-twitter-feeds' ), |
| 330 | 'style' => ['.ctf-quoted-tweet, .ctf-quoted-tweet-text' => 'font-size:{{value}}px!important;line-height:1em;'], |
| 331 | 'options' => CTF_Builder_Customizer_Tab::get_text_size_options() |
| 332 | ], |
| 333 | ]; |
| 334 | } |
| 335 | /** |
| 336 | * |
| 337 | * @since 2.0 |
| 338 | * @return array |
| 339 | */ |
| 340 | static function post_styling_media(){ |
| 341 | return [ |
| 342 | [ |
| 343 | 'type' => 'separator', |
| 344 | 'top' => 20, |
| 345 | 'bottom' => 15, |
| 346 | ], |
| 347 | [ |
| 348 | 'type' => 'heading', |
| 349 | 'stacked' => 'true', |
| 350 | 'heading' => __( 'Media Layout', 'custom-twitter-feeds' ), |
| 351 | ], |
| 352 | [ |
| 353 | 'type' => 'select', |
| 354 | 'id' => 'maxmedia', |
| 355 | 'layout' => 'half', |
| 356 | 'ajaxAction' => 'feedFlyPreview', |
| 357 | 'strongHeading' => 'false', |
| 358 | 'heading' => __( 'Max Visible Media', 'custom-twitter-feeds' ), |
| 359 | 'tooltip' => __( 'Max Visible Media', 'custom-twitter-feeds' ), |
| 360 | 'stacked' => 'true', |
| 361 | 'options' => [ |
| 362 | '1' => '1', |
| 363 | '2' => '2', |
| 364 | '3' => '3', |
| 365 | '4' => '4', |
| 366 | ] |
| 367 | ], |
| 368 | [ |
| 369 | 'type' => 'select', |
| 370 | 'id' => 'imagecols', |
| 371 | 'layout' => 'half', |
| 372 | 'strongHeading' => 'false', |
| 373 | 'heading' => __( 'Media Columns', 'custom-twitter-feeds' ), |
| 374 | 'tooltip' => __( 'Media Columns', 'custom-twitter-feeds' ), |
| 375 | 'stacked' => 'true', |
| 376 | 'options' => [ |
| 377 | 'auto' => __( 'Auto', 'custom-twitter-feeds' ), |
| 378 | '1' => '1', |
| 379 | '2' => '2', |
| 380 | '3' => '3', |
| 381 | ] |
| 382 | ], |
| 383 | ]; |
| 384 | } |
| 385 | /** |
| 386 | * |
| 387 | * @since 2.0 |
| 388 | * @return array |
| 389 | */ |
| 390 | static function post_styling_replies(){ |
| 391 | return [ |
| 392 | ]; |
| 393 | } |
| 394 | /** |
| 395 | * |
| 396 | * @since 2.0 |
| 397 | * @return array |
| 398 | */ |
| 399 | static function post_styling_retweet(){ |
| 400 | return [ |
| 401 | [ |
| 402 | 'type' => 'separator', |
| 403 | 'top' => 30, |
| 404 | 'bottom' => 10, |
| 405 | ], |
| 406 | [ |
| 407 | 'type' => 'switcher', |
| 408 | 'id' => 'include_retweeter', |
| 409 | 'label' => __( '“Retweeted” text', 'custom-twitter-feeds' ), |
| 410 | 'reverse' => 'true', |
| 411 | 'stacked' => 'true', |
| 412 | 'labelStrong' => 'true', |
| 413 | 'options' => [ |
| 414 | 'enabled' => true, |
| 415 | 'disabled' => false |
| 416 | ] |
| 417 | ], |
| 418 | [ |
| 419 | 'type' => 'separator', |
| 420 | 'top' => 10, |
| 421 | 'bottom' => 10, |
| 422 | ], |
| 423 | [ |
| 424 | 'type' => 'switcher', |
| 425 | 'id' => 'include_replied_to', |
| 426 | 'label' => __( '“In Reply to” text', 'custom-twitter-feeds' ), |
| 427 | 'reverse' => 'true', |
| 428 | 'stacked' => 'true', |
| 429 | 'labelStrong' => 'true', |
| 430 | 'options' => [ |
| 431 | 'enabled' => true, |
| 432 | 'disabled' => false |
| 433 | ] |
| 434 | ], |
| 435 | ]; |
| 436 | } |
| 437 | /** |
| 438 | * |
| 439 | * @since 2.0 |
| 440 | * @return array |
| 441 | */ |
| 442 | static function post_styling_twitter_cards(){ |
| 443 | return [ |
| 444 | [ |
| 445 | 'type' => 'separator', |
| 446 | 'top' => 20, |
| 447 | 'bottom' => 15, |
| 448 | ], |
| 449 | [ |
| 450 | 'type' => 'heading', |
| 451 | 'stacked' => 'true', |
| 452 | 'heading' => __( 'Text', 'custom-twitter-feeds' ), |
| 453 | ], |
| 454 | [ |
| 455 | 'type' => 'select', |
| 456 | 'id' => 'cardstextsize', |
| 457 | 'layout' => 'half', |
| 458 | 'strongHeading' => 'false', |
| 459 | 'heading' => __( 'Size', 'custom-twitter-feeds' ), |
| 460 | 'stacked' => 'true', |
| 461 | 'style' => ['.ctf-tc-summary-info *' => 'font-size:{{value}}px!important;'], |
| 462 | 'options' => CTF_Builder_Customizer_Tab::get_text_size_options() |
| 463 | ], |
| 464 | [ |
| 465 | 'type' => 'colorpicker', |
| 466 | 'id' => 'cardstextcolor', |
| 467 | 'layout' => 'half', |
| 468 | 'strongHeading' => 'false', |
| 469 | 'heading' => __( 'Color', 'custom-twitter-feeds' ), |
| 470 | 'style' => ['.ctf-tc-summary-info *' => 'color:{{value}}!important;'], |
| 471 | 'stacked' => 'true' |
| 472 | ], |
| 473 | ]; |
| 474 | } |
| 475 | /** |
| 476 | * |
| 477 | * @since 2.0 |
| 478 | * @return array |
| 479 | */ |
| 480 | static function post_styling_twitter_logo(){ |
| 481 | return [ |
| 482 | ]; |
| 483 | } |
| 484 | |
| 485 | |
| 486 | } |