Files
iTop/sources/Application/UI/Base/Component/DataTable/tTableRowActions.php
bdalsass eda11e97e3 N°5074 - Linkset datatable actions row improvements
Linkset updates, feedbacks 09/12:

- Distinguish action label and tool tip message
- Change default action button label Ok => Confirm
- Use action label in place of default confirm button label
- Attach do not show again preference key to table instance
- Obsolescence flag for link selection (select all)  issue correction
2022-12-20 10:10:25 +01:00

84 lines
1.7 KiB
PHP

<?php
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\DataTable;
use Combodo\iTop\Application\UI\Base\Component\Dialog\DialogUIBlockFactory;
/**
* Trait tTableRowActions
*
* This brings the ability to add action rows to tables.
*
* @internal
* @package Combodo\iTop\Application\UI\Base\Component\DataTable
* @since 3.1.0
*/
trait tTableRowActions
{
/** @var bool static dialog initialized flag to avoid multiple html markups */
static public bool $bDialogInitialized = false;
/**
* @var $aRowActions array array of row actions
* action => {
* label: string,
* tooltip: string,
* icon_classes: string,
* js_row_action: string,
* confirmation => {
* message: string,
* message_row_data: string,
* do_not_show_again_pref_key: string
* }
* }
*/
protected $aRowActions = [];
/**
* Set row actions.
*
* @param array $aRowActions
*
* @return $this
*/
public function SetRowActions(array $aRowActions)
{
$this->aRowActions = $aRowActions;
return $this;
}
/**
* Get row actions.
*
* @return array|null
*/
public function GetRowActions(): ?array
{
return $this->aRowActions;
}
/**
* Return true if row actions is set and not empty.
*
* @return bool
*/
public function HasRowActions(): bool
{
return isset($this->aRowActions) && count($this->aRowActions);
}
/**
* Return row actions template.
*
* @return \Combodo\iTop\Application\UI\Base\Component\Template\Template
*/
public function GetRowActionsTemplate()
{
return DataTableUIBlockFactory::MakeActionRowToolbarTemplate($this);
}
}