mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
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
|
||||
|
28
src/Extensions/SubmittedFormEx.php
Normal file
28
src/Extensions/SubmittedFormEx.php
Normal file
@ -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
Block a user