init
This commit is contained in:
14
site/plugins/embed/lib/fieldMethods.php
Normal file
14
site/plugins/embed/lib/fieldMethods.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\Content;
|
||||
|
||||
return array(
|
||||
'toEmbed' => function($field) {
|
||||
// allows if($embed = $page->myfield()->toEmbed()) { echo $embed->code() }
|
||||
if($field->isEmpty() || !count(Yaml::decode($field->value)) || empty($field->yaml()['media'])) {
|
||||
return null;
|
||||
}
|
||||
$content = new Content($field->yaml()['media'], $field->parent());
|
||||
return $content;
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user