--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\Magic\Fields;
+
+
+class FolderTree extends SelectFromArray
+{
+ protected $_root = '';
+
+ /**
+ * @param string $root
+ */
+ public function setRoot(string $root): void
+ {
+ $this->_root = $root;
+ }
+
+ /**
+ * @return string
+ */
+ public function getRoot(): string
+ {
+ return $this->_root;
+ }
+
+ /**
+ * @return array
+ */
+ public function getOptions(): array
+ {
+ $options = [];
+
+ $iterator = \Cubist\Util\Files\Files::getRecursiveDirectoryIterator($this->getRoot());
+
+ foreach ($iterator as $item) {
+ /** @var $item \SplFileInfo */
+ if ($item->isFile()) {
+ continue;
+ }
+ $options[$item->getFilename()] = $item->getFilename();
+ }
+ return $options;
+ }
+}
namespace Cubist\Backpack\Magic;
+use Cubist\Backpack\CubistBackpackServiceProvider;
use Illuminate\Support\Facades\Http;
class Form extends SubForm
* @return string
*/
- public function render()
+ public function render(callable $callback = null)
{
- return view('form.form', ['form' => $this]);
+ return view(CubistBackpackServiceProvider::NAMESPACE . '::form.form', ['form' => $this])->render($callback);
}
public function __toString()
{
return $this->_title;
}
+
+ public function tabsEnabled()
+ {
+ return false;
+ }
+
+ public function getTabs()
+ {
+ return [];
+ }
+
+ public function fields()
+ {
+ return [];
+ }
+
+ public function getAutoFocusOnFirstField(){
+ return true;
+ }
+
+ public function inlineErrorsEnabled(){
+ return false;
+ }
}
+@php
+ $crud=$form;
+ $action='create';
+ $fields=$form->fields();
+@endphp
+
<h2>{{$form->getTitle()}}</h2>
-<div class="card">
- <form action="{{$form->getAction()}}" method="{{$form->getMethod()}}" enctype="{{$form->getEnctype()}}">
- @if($form->isCsrf())
- @csrf
- @endif
- </form>
-</div>
+
+@include('crud::form_content')