first commit

This commit is contained in:
Eric Li
2025-06-13 12:09:50 +08:00
commit b12cd07419
545 changed files with 39389 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<?php
namespace App\Fields;
use Backpack\CRUD\app\Library\CrudPanel\CrudField;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade;
class IframeField
{
/**
* Create an iframe custom field.
*
* @param string $name Field name (not used for display, only for form data)
* @param string $label Field label
* @param array $options Additional options (url, width, height, extra_attributes, hint)
* @return CrudField
*/
public static function make(string $name, string $label, array $options = [])
{
$url = isset($options['url']) && is_callable($options['url'])
? $options['url'](CrudPanelFacade::getFacadeRoot())
: ($options['url'] ?? null);
$field = [
'name' => $name,
'label' => $label,
'type' => 'iframe',
'url' => $url, // URL to display in iframe
'width' => $options['width'] ?? '', // Iframe width
'height' => $options['height'] ?? '', // Iframe height
'extra_attributes' => $options['extra_attributes'] ?? [], // Additional iframe attributes
'hint' => $options['hint'] ?? null, // Help text
];
return \Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade::field($field);
}
}