2016-08-19 00:51:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms;
|
|
|
|
|
|
|
|
use SilverStripe\View\ViewableData;
|
|
|
|
|
|
|
|
class Form_FieldMap extends ViewableData
|
|
|
|
{
|
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
|
|
|
* @var Form
|
|
|
|
*/
|
|
|
|
protected $form;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
public function __construct($form)
|
|
|
|
{
|
|
|
|
$this->form = $form;
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
|
|
|
* Ensure that all potential method calls get passed to __call(), therefore to dataFieldByName
|
|
|
|
* @param string $method
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function hasMethod($method)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
public function __call($method, $args = null)
|
|
|
|
{
|
|
|
|
return $this->form->Fields()->fieldByName($method);
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
}
|