mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
36 lines
910 B
PHP
36 lines
910 B
PHP
<?php
|
|
|
|
namespace SilverStripe\UserForms\FormField;
|
|
|
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
|
|
|
/**
|
|
* Front end composite field for userforms
|
|
*/
|
|
class UserFormsGroupField extends UserFormsCompositeField
|
|
{
|
|
public function __construct($children = null)
|
|
{
|
|
parent::__construct($children);
|
|
$this->setTag('fieldset');
|
|
}
|
|
|
|
public function getLegend()
|
|
{
|
|
// Legend defaults to title
|
|
return parent::getLegend() ?: $this->Title();
|
|
}
|
|
|
|
public function processNext(EditableFormField $field)
|
|
{
|
|
// When ending a group, jump up one level
|
|
if ($field instanceof EditableFieldGroupEnd) {
|
|
return $this->getParent();
|
|
}
|
|
|
|
// Otherwise behave as per normal composite field
|
|
return parent::processNext($field);
|
|
}
|
|
}
|