Source of file MinorActionsHolder.php
Size: 2,045 Bytes - Last Modified: 2021-12-23T10:04:57+00:00
/var/www/docs.ssmods.com/process/src/code/Buttons/MinorActionsHolder.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | <?php namespace Milkyway\SS\GridFieldUtils; /** * Milkyway Multimedia * MinorActionsHolder.php * * @package milkyway-multimedia/ss-gridfield-utils * @author Mellisa Hankins <mell@milkywaymultimedia.com.au> */ use GridField_HTMLProvider; use ArrayData; use ArrayList; use ViewableData; class MinorActionsHolder implements GridField_HTMLProvider { protected $targetFragment; protected $title; protected $id; protected $showEmptyString; /** * @param string $targetFragment * @param string $title * @param string $id */ public function __construct($targetFragment = 'buttons-before-left', $title = '', $id = '') { $this->targetFragment = $targetFragment; $this->id = $id; $this->title = $title; } /** * @return string */ public function getTitle() { return $this->title; } /** * @param string $title * @return static */ public function setTitle($title) { $this->title = $title; return $this; } /** * @return string */ public function getShowEmptyString() { return $this->showEmptyString; } /** * @param string $showEmptyString * @return static */ public function setShowEmptyString($showEmptyString = '') { $this->showEmptyString = $showEmptyString; return $this; } /** * @inheritdoc */ public function getHTMLFragments($gridField) { $target = $this->id ? $this->targetFragment . '-' . $this->id : $this->targetFragment; return [ $this->targetFragment => ArrayData::create([ 'Title' => $this->title, 'ShowEmptyString' => $this->showEmptyString, 'TargetFragmentName' => $this->targetFragment, 'TargetFragmentID' => $target, 'Actions' => "\$DefineFragment(actions-{$target})", ])->renderWith('GridField_MinorActionsHolder'), ]; } } |