File: /var/www/vhosts/creativefellows.nl/recht.creativefellows.nl/src/Domain/Field/FieldData.php
<?php
namespace App\Domain\Field;
/**
* Lease Term data
*/
final class FieldData
{
function __construct(array $data =null)
{
foreach((array) $data as $key => $val)
{
$this->$key = $val;
}
}
public function name()
{
return $this->field_naam;
}
public function setValue($value)
{
switch( $this->formElement() )
{
default:
$this->type = new TextType($value);
break;
case "link":
$this->type = new LinkType($value);
break;
case "files":
$this->type = new UploadType($value);
break;
case "image":
$this->type = new ImageType($value);
break;
case "dragdrop":
$this->type = new DragDropType();
foreach((array) $value as $row)
{
$html_row = new SectionRow($row);
$this->type->set($html_row);
}
break;
}
}
public function value($html_tag = null,$element_class=null)
{
return $this->type->value($html_tag,$element_class);
}
public function isDragDrop()
{
return $this->field_id == 46 ? true :false;
}
public function isEntryLinks()
{
return $this->field_id == 12 ? true :false;
}
public function translate()
{
return $this->translate == 1 ? true : false;
}
public function isLink()
{
return $this->form_element == "link" ? true : false;
}
public function hasTemplateData()
{
return $this->link_data != 0 ? true :false;
}
private function formElement()
{
return $this->form_element;
}
}