Commit 970d7a97 authored by Sylvain's avatar Sylvain

Ajout d'un champs folder

parent 848301ea
......@@ -194,6 +194,39 @@ class FieldBt4
return $render;
}
/**
* Retourne le rendu du champs Image avec ses paramètres
* @return string Le rendu du champs
*/
public function renderFolder(): string
{
$template = '<div class="input-group img-group">' . PHP_EOL;
$template .= ' <div class="input-group-prepend">' . PHP_EOL;
$template .= ' <img id="thumb-%s" class="image-thumb" src="%s" alt="thumb">' . PHP_EOL;
$template .= ' </div>' . PHP_EOL;
$template .= ' %s' . PHP_EOL;
$template .= ' <div class="input-group-append">' . PHP_EOL;
$template .= ' <button class="btn btn-outline-secondary popupfinder" type="button" id="btn-%s" data-field="%s" data-folder="true">' . PHP_EOL;
$template .= ' %s' . PHP_EOL;
$template .= ' </button>' . PHP_EOL;
$template .= ' </div>' . PHP_EOL;
$template .= '</div>';
$render = vsprintf($template, [
$this->id,
url('images/folder.jpg'),
$this->renderInput(),
$this->id,
'#' . $this->id,
$this->suffix ?? '<i class="fa fa-picture-o mr-2"></i>Choisir image'
]);
$this->prefix = null;
$this->suffix = null;
return $render;
}
/**
* Retourne le rendu du champs Image avec ses paramètres
* @return string Le rendu du champs
......
......@@ -147,6 +147,20 @@ class Field
return $field->renderHTML($render);
}
/**
* Retourne un champs dossier avec son environnement
* @param array $attrs Les attributs du champs
* @return string le HTML du champs et de son environnement
*/
public function folder($attrs = []): string
{
$field = new FieldBt4($attrs);
$image = $field->renderFolder();
$render = $field->renderWrapFieldEnvironment($image);
return $field->renderHTML($render);
}
/**
* Retourne un champs toggle avec son environnement
* @param array $attrs Les attributs du champs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment