| 1 |
<?php |
| 2 |
/** |
| 3 |
* Common attributes shared by every atomic block. Each block's attributes.php |
| 4 |
* includes this and adds its own extras (tag, src, svgCode …). |
| 5 |
*/ |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
|
| 11 |
return [ |
| 12 |
'block_id' => [ 'type' => 'string', 'default' => '' ], |
| 13 |
'blockVersion' => [ 'type' => 'number', 'default' => 3 ], |
| 14 |
'globalClasses' => [ 'type' => 'array', 'default' => [] ], |
| 15 |
'htmlId' => [ 'type' => 'string', 'default' => '' ], |
| 16 |
// Any atomic element can be a link — that is what makes a whole card |
| 17 |
// clickable — so this is shared rather than per-block. |
| 18 |
'link' => [ 'type' => 'object', 'default' => [ 'url' => '', 'newTab' => false, 'noFollow' => false ] ], |
| 19 |
'animation' => [ 'type' => 'object', 'default' => [ 'type' => '', 'duration' => '0.6', 'delay' => '0' ] ], |
| 20 |
'animations' => [ 'type' => 'array', 'default' => [] ], |
| 21 |
'transitionDuration' => [ 'type' => 'string', 'default' => '' ], |
| 22 |
'alignment' => [ 'type' => 'object', 'default' => [ 'value' => '', 'valueTablet' => '', 'valueMobile' => '' ] ], |
| 23 |
// Buckets are created on demand as controls are touched, so the default is |
| 24 |
// just the schema marker — see StyleBuckets for the shape. These defaults |
| 25 |
// back-fill attributes a saved block omitted (AssetsGenerator), so the |
| 26 |
// marker has to be here or the styles would read as an unreadable schema. |
| 27 |
'styles' => [ 'type' => 'object', 'default' => \ABlocks\Classes\StyleBuckets::empty_styles() ], |
| 28 |
// Shared "Advanced" tab: free-form CSS (with a `selector` placeholder) and |
| 29 |
// per-device visibility. Consumed by AtomicBlockBase::build_css(). |
| 30 |
'customCSS' => [ 'type' => 'string', 'default' => '' ], |
| 31 |
'hideOn' => [ 'type' => 'object', 'default' => [ 'desktop' => false, 'tablet' => false, 'mobile' => false ] ], |
| 32 |
]; |
| 33 |
|