More work on this, incomplete!
Validate Build / validate-build (push) Canceled after 0s

This commit is contained in:
Cooper Dalrymple
2026-10-06 17:00:20 -05:00
parent 5f702470cc
commit b8902b4afa
23 changed files with 2138 additions and 175 deletions
+4 -23
View File
@@ -10,34 +10,15 @@
namespace Ogre\Consent\Services;
use Ogre\Consent\BlockService;
use WP_Block;
use Override;
use WP_HTML_Tag_Processor;
use Ogre\Consent as Plugin;
use Ogre\Consent\EmbedBlockService;
defined('ABSPATH') || exit;
final class YouTube extends BlockService {
final class YouTube extends EmbedBlockService {
protected function __construct() {
parent::__construct('core/iframe', 'youtube');
}
#[Override]
public function render_block(string $block_content, array $block, WP_Block $instance): string
{
// TODO: Check block iframe type
$tags = new WP_HTML_Tag_Processor($block_content);
if ($tags->next_tag('iframe')) {
$tags->set_attribute('data-name', $this->name);
$src = $tags->get_attribute('src');
$tags->remove_attribute('src');
$tags->set_attribute('data-src', $src);
}
return $tags->get_updated_html();
parent::__construct('youtube', Plugin::__('YouTube'));
}
}