Skip to content
This repository was archived by the owner on Jul 4, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/twill.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
'icon' => 'star-feature',
'component' => 'a17-block-review',
],
'youtube' => [
'title' => 'YouTube Video',
'icon' => 'video',
'component' => 'a17-block-youtube',
],
],
'block_views_path' => 'blocks',
'block_single_layout' => 'admin/block-preview'
Expand Down
2 changes: 1 addition & 1 deletion resources/views/admin/articles/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
])

@formField('block_editor', [
'blocks' => ['text', 'quotation', 'sidebar', 'image', 'review', ]
'blocks' => ['text', 'quotation', 'sidebar', 'image', 'review', 'youtube', ]
])
@stop
4 changes: 4 additions & 0 deletions resources/views/admin/blocks/youtube.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@formField('input', [
'name' => 'link',
'label' => 'YouTube Video Link'
])
6 changes: 6 additions & 0 deletions resources/views/blocks/youtube.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
preg_match('/((?<=watch\?v=)|(?<=youtu.be\/))[a-zA-Z_0-9]+\/?/', $block->input('link'), $matches)
?>
<section class="youtube">
<iframe width="560" height="315" src={{ "https://www.youtube-nocookie.com/embed/" . $matches[0] }} frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</section>