Commit 32ee2a32 authored by Sylvain's avatar Sylvain

Mise à jour updateAttributes (valeur à 0)

parent 2bbe6e4c
......@@ -121,11 +121,11 @@ class Field2Bt4
*/
public function renderPdf(): string
{
$template = '<div class="input-group">' . PHP_EOL;
$template = '<div class="input-group img-group">' . PHP_EOL;
$template .= ' <div class="input-group-prepend">' . PHP_EOL;
$template .= ' <div class="input-group-text">' . PHP_EOL;
//$template .= ' <div class="input-group-text">' . PHP_EOL;
$template .= ' %s' . PHP_EOL;
$template .= ' </div>' . PHP_EOL;
//$template .= ' </div>' . PHP_EOL;
$template .= ' </div>' . PHP_EOL;
$template .= ' %s' . PHP_EOL;
$template .= ' <div class="input-group-append">' . PHP_EOL;
......@@ -136,7 +136,7 @@ class Field2Bt4
$template .= '</div>';
$render = vsprintf($template, [
$this->prefix ?? '<i class="fa fa-file-pdf-o text-danger"></i>',
$this->prefix ?? '<img class="image-thumb" src="'.asset('images/icons/pdf.svg').'">',
$this->renderInput(),
$this->makeID('id'),
'#' . $this->makeID('id'),
......@@ -446,7 +446,6 @@ class Field2Bt4
'name' => $this->makeName(),
'value' => $this->makeValue()
];
$this->attributes = $this->updateAttributes($attrs_default);
$render = vsprintf($template, [
......@@ -640,6 +639,7 @@ class Field2Bt4
// Etape 2 - Fusion des attributs avec les valeurs par défaut
$attributes = array_merge($default, $attrs);
// Etape 3 - 2ème passe avec fusion des valeurs de type tableau
foreach ($attributes as $name => $value) {
......@@ -650,7 +650,12 @@ class Field2Bt4
}
}
$attributes = array_filter($attributes);
// Etape 4 - Suppression des valeurs null
foreach($attributes as $name => $value) {
if (is_null($value)) {
unset($attributes[$name]);
}
}
return $attributes;
}
......
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