File: D:/HostingSpaces/SBogers10/boomdekwekerij.komma.nl/vendor/komma/kms/src/Core/Attributes/Video.php
<?php
namespace Komma\KMS\Core\Attributes;
use Komma\KMS\Core\Attributes\Interfaces\HasLabelInterface;
use Komma\KMS\Core\Attributes\Traits\LabelTrait;
use Komma\KMS\Core\Attributes\Traits\PlaceholderTextTrait;
class Video extends Attribute implements HasLabelInterface
{
use LabelTrait;
/** Whether or not the video may automatically start playing */
private bool $autoPlay = false;
/**
* Returns a view that visually represents this attribute
*
* @return string
*/
public function render(): string
{
return view('KMS::attributes.video', [
'attribute' => $this
])->render();
}
/**
* @return bool
*/
public function getAutoPlay(): bool
{
return $this->autoPlay;
}
/**
* @param bool $autoPlay
* @return Video
*/
public function setAutoPlay(bool $autoPlay): Video
{
$this->autoPlay = $autoPlay;
return $this;
}
public function prepareValueForViewComponent($value)
{
$explodedVideo = explode(',', $value);
if(sizeof($explodedVideo) == 1) return $value;
[$autoplay, $video_id] = $explodedVideo;
return collect(['autoplay' => $autoplay, 'video_id' => $video_id]);
}
}