Source of file CMS.php
Size: 1,199 Bytes - Last Modified: 2022-02-21T10:02:08+00:00
/var/www/docs.ssmods.com/process/src/src/CMS.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 | <?php namespace Arillo\Utils; use SilverStripe\Assets\Image; use SilverStripe\Forms\FieldList; use SilverStripe\ORM\FieldType\DBField; /** * CMS helper functions. * * @package Arillo * @subpackage Utils * @author <bumbus sf@arillo.net> */ class CMS { /** * Call in getCMSActions to remove campaign related actions. * * @param FieldList $actions * @return FieldList */ public static function remove_campaign_actions(FieldList $actions) { if ($field = $actions->fieldByName('ActionMenus.MoreOptions')) { $field->removeByName('action_addtocampaign'); } return $actions; } /** * Thumbnail for gridfield usage * @param Image $image * @param int $width * @param int $height * @return DBField */ public static function thumbnail( Image $image, int $width = 90, int $height = 90 ) { if ($image && $image->exists()) { return DBField::create_field( 'HTMLText', "<img src='{$image->Fill($width, $height)->getURL()}' />" ); } return '[no image]'; } } |