VideoExtras::handle_shortcode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 4
c 1
b 1
f 0
nc 1
nop 5
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Sunnysideup\VideoEmbedExtras\View\ShortCodes;
4
5
use SilverStripe\View\Shortcodes\EmbedShortcodeProvider;
6
7
class VideoExtras extends EmbedShortcodeProvider
8
{
9
    // public static function embedForTemplate($embed, $arguments) {
10
    //     return parent::embedForTemplate($embed, $arguments);
11
    // }
12
13
    public static function handle_shortcode($arguments, $content, $parser, $shortcode, $extra = array())
14
    {
15
        $string = parent::handle_shortcode($arguments, $content, $parser, $shortcode, $extra);
16
        $string = str_replace('></iframe' , ' loading="lazy"></iframe', $string);
17
        $string = str_replace('></iframe' , ' allowfullscreen></iframe', $string);
18
19
        return $string;
20
    }
21
}
22