cms-niceties/src/Extensions/SubmittedFormEx.php

33 lines
667 B
PHP
Raw Normal View History

2022-04-08 11:12:47 +02:00
<?php
namespace A2nt\CMSNiceties\Extensions;
use SilverStripe\ORM\DataExtension;
2022-05-10 13:09:06 +02:00
/**
* Class \A2nt\CMSNiceties\Extensions\SubmittedFormEx
*
* @property \A2nt\CMSNiceties\Extensions\SubmittedFormEx $owner
*/
2022-04-08 11:12:47 +02:00
class SubmittedFormEx extends DataExtension
{
public function Title()
{
$obj = $this->owner;
$parent = $obj->Parent();
$title = '#' . $obj->ID;
if(!$parent) {
return $title;
}
$cols = $parent->SubmissionColumns();
foreach ($cols as $col) {
$name = $col->getField('Name');
2022-04-08 11:14:21 +02:00
$title .= ' '.$obj->relField($name);
2022-04-08 11:12:47 +02:00
}
2022-04-08 11:14:21 +02:00
2022-04-08 11:12:47 +02:00
return $title;
}
}