silverstripe-elemental-basics/src/Models/TeamMember.php

64 lines
1.3 KiB
PHP
Raw Normal View History

2021-06-08 10:38:35 +02:00
<?php
/**
* Created by PhpStorm.
* User: tony
* Date: 6/30/18
* Time: 11:36 PM
*/
namespace A2nt\ElementalBasics\Models;
use SilverStripe\Assets\Image;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned;
2021-06-19 21:57:08 +02:00
use A2nt\CMSNiceties\Extensions\SocialExtension;
2021-06-08 10:38:35 +02:00
class TeamMember extends DataObject
{
private static $table_name = 'TeamMember';
private static $db = [
'FirstName' => 'Varchar(254)',
'LastName' => 'Varchar(254)',
'Company' => 'Varchar(254)',
'Position' => 'Varchar(254)',
'Content' => 'HTMLText',
];
private static $has_one = [
'Photo' => Image::class,
];
private static $extensions = [
SocialExtension::class,
Versioned::class,
];
private static $owns = [
'Photo',
];
private static $summary_fields = [
'Company',
'FirstName',
'LastName',
'Position',
];
private static $searchable_fields = [
'FirstName',
'LastName',
];
private static $frontend_searchable_fields = [
'FirstName:PartialMatch',
'LastName:PartialMatch',
'Content:PartialMatch',
];
public function getTitle()
{
return $this->getField('Company').' | '.$this->getField('FirstName').' '.$this->getField('LastName');
}
}