Commit 848301ea authored by Sylvain's avatar Sylvain

Fichier example

parent b482c733
......@@ -32,6 +32,6 @@
}
},
"require-dev": {
"laravel/framework": "5.5.x"
"laravel/framework": "5.8.x"
}
}
<?php
namespace Goldenscarab\Modulus\Service\Field;
use \Illuminate\Support\HtmlString;
class Option extends FieldBt4 {
private $is_dynamic;
private $source;
private $label_param;
private $value_param;
private $datas;
private $template;
private $attributes;
private $class;
private $callback;
public function __construct()
{
}
public function setSource($source)
{
$this->source = $source;
}
public function setLabelParam($value)
{
$this->label_param = $value;
}
public function setValueParam($value)
{
$this->value_param = $value;
}
public function setDatas($value)
{
$this->datas = $value;
}
public function setTemplate($value)
{
$this->template = $value;
}
public function setAttributes($value)
{
$this->attributes = $value;
}
public function setClass($value)
{
$this->class = $value;
}
public function setCallback($value)
{
$this->callback = $value;
}
public function getOptionValue()
{
if (is_null($this->value_param)) {
return collect($this->source)->keys()->first();
} else {
return $this->objectToString(
null,
$this->value_param,
$this->callback,
$this->source
);
}
}
public function getOptionLabel()
{
if (is_null($this->label_param)) {
return collect($this->source)->first();
} else {
return $this->objectToString(
$this->template,
$this->label_param,
$this->callback,
$this->source
);
}
}
public function getDatasRender()
{
$render = '';
if (!is_null($this->datas)) {
$render = ' ';
foreach ($this->datas as $attr => $value) {
$render .= $this->renderDatas([$attr => data_get($this->source, $value)]);
}
}
return $render;
}
}
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