mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
IMPR: Vimeo video options, optional loading assets with absolute URL
This commit is contained in:
parent
afb39c8b22
commit
347c389447
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace A2nt\CMSNiceties\Extensions;
|
||||
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
@ -84,10 +83,9 @@ class EmbeddedObjectExtension extends DataExtension
|
||||
);
|
||||
$videoID = $matches[1];
|
||||
|
||||
$params = array_merge($params, [
|
||||
'controls='.($this->owner->getField('Controls') ? '1': '0'),
|
||||
'background=1',
|
||||
]);
|
||||
/*$params = array_merge($params, [
|
||||
'controls='.($this->owner->getField('Controls') ? '1' : '0'),
|
||||
]);*/
|
||||
|
||||
if ($this->owner->getField('Autoplay')) {
|
||||
$params[] = 'autoplay=1';
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/** @noinspection PhpUnusedPrivateFieldInspection */
|
||||
|
||||
/**
|
||||
@ -32,6 +33,7 @@ class WebpackTemplateProvider implements TemplateGlobalProvider
|
||||
*/
|
||||
private static $dist = 'client/dist';
|
||||
private static $webp = false;
|
||||
private static $absolute_path = false;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
@ -135,15 +137,23 @@ class WebpackTemplateProvider implements TemplateGlobalProvider
|
||||
public static function toPublicPath($path): string
|
||||
{
|
||||
$cfg = self::config();
|
||||
return strpos($path, '//') === false ?
|
||||
Controller::join_links(
|
||||
if (strpos($path, '//')) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
$link = Controller::join_links(
|
||||
RESOURCES_DIR,
|
||||
self::projectName(),
|
||||
$cfg['dist'],
|
||||
(strpos($path, '.css') ? 'css' : 'js'),
|
||||
$path
|
||||
)
|
||||
: $path;
|
||||
);
|
||||
|
||||
if ($cfg['absolute_path']) {
|
||||
$link = Director::absoluteURL($link);
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
public static function config(): array
|
||||
|
Loading…
Reference in New Issue
Block a user