container->get_permission( 'edit_ctas' ), 'popup-maker-call-to-actions', [ $this, 'render_page' ] ); } /** * Render settings page title & container. * * @return void */ public function render_page() { ?>
[ 'ctaId' => [ 'type' => 'string' ], 'instanceId' => [ 'type' => 'string' ], ], 'render_callback' => [ $this, 'render_cta_block' ], ]); } /** * Render CTA block. * * @param array{ctaId: int, instanceId: string} $attributes * @return string */ public function render_cta_block( $attributes ) { $cta_id = $attributes['ctaId'] ?? null; $instance_id = $attributes['instanceId'] ?? uniqid( 'cta_instance_' ); if ( ! $cta_id ) { return ''; } $cta_post = get_post( $cta_id ); $label = get_post_meta( $cta_id, 'cta_label', true ); // Basic rendering with tracking return sprintf( '