Add TV stick animation and rendering support for platform rows
This commit is contained in:
@@ -554,6 +554,7 @@ add_action( 'init', function () {
|
||||
'imgAlt' => [ 'type' => 'string', 'default' => '' ],
|
||||
'imgWidth' => [ 'type' => 'number', 'default' => 300 ],
|
||||
'deviceAnim' => [ 'type' => 'boolean', 'default' => false ],
|
||||
'tvStick' => [ 'type' => 'boolean', 'default' => false ],
|
||||
],
|
||||
'supports' => $block_supports,
|
||||
'render_callback' => 'oribi_render_platform_row',
|
||||
@@ -1339,9 +1340,8 @@ function oribi_render_platform_row( $a ) {
|
||||
$img_alt = ! empty( $a['imgAlt'] ) ? $a['imgAlt'] : '';
|
||||
$img_w = ! empty( $a['imgWidth'] ) ? intval( $a['imgWidth'] ) : 300;
|
||||
|
||||
// Check if this is a dashboard card (by heading content or dashboard flag)
|
||||
$heading_text = $a['heading'] ?? '';
|
||||
$is_dashboard = ! empty( $a['isDashboard'] ) || stripos( $heading_text, 'dashboard' ) !== false || stripos( $heading_text, 'data' ) !== false;
|
||||
// Only render animated dashboard when explicitly flagged
|
||||
$is_dashboard = ! empty( $a['isDashboard'] );
|
||||
|
||||
if ( $is_dashboard ) {
|
||||
// Render animated dashboard chart SVG
|
||||
@@ -1480,6 +1480,24 @@ function oribi_render_platform_row( $a ) {
|
||||
$da .= '</div>';
|
||||
$visual_html = $da;
|
||||
$visual_cls = 'platform-visual has-anim';
|
||||
} elseif ( ! empty( $a['tvStick'] ) ) {
|
||||
$ts = '<div class="ts-stage" data-tv-stick-anim aria-hidden="true">';
|
||||
$ts .= '<div class="ts-tv">';
|
||||
$ts .= '<div class="ts-tv__body">';
|
||||
$ts .= '<div class="ts-tv__screen"></div>';
|
||||
$ts .= '<div class="ts-tv__port"></div>';
|
||||
$ts .= '</div>';
|
||||
$ts .= '<div class="ts-tv__feet"><div class="ts-tv__foot"></div><div class="ts-tv__foot"></div></div>';
|
||||
$ts .= '</div>';
|
||||
$ts .= '<div class="ts-stick">';
|
||||
$ts .= '<div class="ts-stick__body">';
|
||||
$ts .= '<div class="ts-stick__led"></div>';
|
||||
$ts .= '</div>';
|
||||
$ts .= '<div class="ts-stick__connector"></div>';
|
||||
$ts .= '</div>';
|
||||
$ts .= '</div>';
|
||||
$visual_html = $ts;
|
||||
$visual_cls = 'platform-visual has-tv-stick';
|
||||
} else {
|
||||
$visual_html = oribi_render_icon( $a['visual'] ?? '' );
|
||||
$visual_cls = 'platform-visual';
|
||||
|
||||
Reference in New Issue
Block a user