IMPR: Better Submitted Forms titles
This commit is contained in:
parent
70ed43839a
commit
88d3076b9d
|
@ -40,6 +40,10 @@ SilverStripe\UserForms\Form\UserForm:
|
|||
extensions:
|
||||
- A2nt\CMSNiceties\Extensions\PlaceholderFormExtension
|
||||
|
||||
SilverStripe\UserForms\Model\Submission\SubmittedForm:
|
||||
extensions:
|
||||
- A2nt\CMSNiceties\Extensions\SubmittedFormEx
|
||||
|
||||
Page:
|
||||
searchable_objects:
|
||||
- A2nt\CMSNiceties\Models\TeamMember
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace A2nt\CMSNiceties\Extensions;
|
||||
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
|
||||
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');
|
||||
$title .= ' '.$item->relField($name);
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue