mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°3526 - Clean up pass on UIBlockFactories
- Add PHPDoc - Remove (Object) return type hint on overloadable methods
This commit is contained in:
@@ -14,18 +14,18 @@ namespace Combodo\iTop\Application\UI\Base;
|
||||
* @package Combodo\iTop\Application\UI\Base
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
* @api
|
||||
*/
|
||||
abstract class AbstractUIBlockFactory implements iUIBlockFactory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @used-by static::GetTwigTagName()
|
||||
* @see static::GetTwigTagName()
|
||||
*/
|
||||
public const TWIG_TAG_NAME = 'UIBlock';
|
||||
/**
|
||||
* @var string
|
||||
* @useb-by static::GetUIBlockClassName()
|
||||
* @see static::GetUIBlockClassName()
|
||||
*/
|
||||
public const UI_BLOCK_CLASS_NAME = UIBlock::class;
|
||||
|
||||
|
||||
@@ -27,12 +27,15 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Alert
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*
|
||||
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-alerts to see live examples
|
||||
*/
|
||||
class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIAlert';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Alert::class;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,16 +25,18 @@ use Dict;
|
||||
/**
|
||||
* Class ButtonUIBlockFactory
|
||||
*
|
||||
* @internal
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Button
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*
|
||||
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-buttons to see live examples
|
||||
*/
|
||||
class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIButton';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Button::class;
|
||||
|
||||
//---------------------------------------------
|
||||
@@ -50,7 +52,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
|
||||
*/
|
||||
public static function MakeNeutral(string $sLabel, string $sName = null, ?string $sId = null): Button
|
||||
public static function MakeNeutral(string $sLabel, string $sName = null, ?string $sId = null)
|
||||
{
|
||||
$oButton = new ButtonJS($sLabel, $sId);
|
||||
$oButton->SetActionType(Button::ENUM_ACTION_TYPE_REGULAR)
|
||||
@@ -80,7 +82,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
|
||||
}
|
||||
|
||||
@@ -122,7 +124,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
|
||||
}
|
||||
|
||||
@@ -144,7 +146,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
}
|
||||
@@ -170,7 +172,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
}
|
||||
@@ -193,7 +195,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
}
|
||||
@@ -215,7 +217,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
}
|
||||
@@ -237,7 +239,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
}
|
||||
@@ -259,7 +261,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
}
|
||||
@@ -281,7 +283,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sValue = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
$sLabel = $sLabel ?? Dict::S('UI:Button:Cancel');
|
||||
$sName = $sName ?? 'cancel';
|
||||
|
||||
@@ -333,7 +335,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
public static function MakeLinkNeutral(
|
||||
string $sURL, ?string $sLabel = '', ?string $sIconClasses = null, ?string $sTarget = null,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
if (empty($sTarget)) {
|
||||
$sTarget = ButtonURL::DEFAULT_TARGET;
|
||||
}
|
||||
@@ -416,7 +418,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sName = null,
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
$oButton = new ButtonJS($sLabel, $sId);
|
||||
$oButton->SetActionType($sActionType)
|
||||
->SetColor($sColor);
|
||||
@@ -459,7 +461,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
string $sActionType,
|
||||
string $sTarget = null,
|
||||
?string $sId = null
|
||||
): Button {
|
||||
) {
|
||||
$oButton = new ButtonURL($sLabel, $sURL, $sId, $sTarget);
|
||||
$oButton->SetActionType($sActionType)
|
||||
->SetColor($sColor);
|
||||
|
||||
@@ -14,14 +14,16 @@ use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
|
||||
/**
|
||||
* Class ButtonGroupUIBlockFactory
|
||||
*
|
||||
* @internal
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Button
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class ButtonGroupUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIButtonGroup';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = ButtonGroup::class;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,11 +10,27 @@ namespace Combodo\iTop\Application\UI\Base\Component\CollapsibleSection;
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
* Class CollapsibleSectionUIBlockFactory
|
||||
*
|
||||
* @author Pierre Goiffon <pierre.goiffon@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\CollapsibleSection
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class CollapsibleSectionUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UICollapsibleSection';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = CollapsibleSection::class;
|
||||
|
||||
/**
|
||||
* @param string $sTitle
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSection
|
||||
*/
|
||||
public static function MakeStandard(string $sTitle, ?string $sId = null)
|
||||
{
|
||||
return new CollapsibleSection($sTitle, [], $sId);
|
||||
|
||||
@@ -33,13 +33,16 @@ use WebPage;
|
||||
/**
|
||||
* Class DataTableUIBlockFactory
|
||||
*
|
||||
* @internal
|
||||
* @author Anne-Catherine Cognet <anne-catherine.cognet@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\DataTable
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIDataTable';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = DataTable::class;
|
||||
|
||||
/**
|
||||
@@ -937,7 +940,7 @@ JS;
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTable\FormTable
|
||||
*/
|
||||
public static function MakeForForm(string $sRef, array $aColumns, array $aData = [], string $sFilter = ''): FormTable
|
||||
public static function MakeForForm(string $sRef, array $aColumns, array $aData = [], string $sFilter = '')
|
||||
{
|
||||
$oTable = new FormTable("datatable_".$sRef);
|
||||
$oTable->SetRef($sRef);
|
||||
|
||||
@@ -22,7 +22,9 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
*/
|
||||
class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIField';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Field::class;
|
||||
|
||||
public static function MakeFromParams($aParams)
|
||||
|
||||
@@ -21,7 +21,9 @@ use ormStyle;
|
||||
*/
|
||||
class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIFieldBadge';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = FieldBadge::class;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,10 +16,13 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\FieldSet
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class FieldSetUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIFieldSet';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = FieldSet::class;
|
||||
|
||||
/**
|
||||
@@ -28,7 +31,7 @@ class FieldSetUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSet A standard fieldset in which you can add UIBlocks
|
||||
*/
|
||||
public static function MakeStandard(string $sLegend, ?string $sId = null): FieldSet
|
||||
public static function MakeStandard(string $sLegend, ?string $sId = null)
|
||||
{
|
||||
return new FieldSet($sLegend, $sId);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,13 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Form
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
* @api
|
||||
*/
|
||||
class FormUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIForm';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Form::class;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,10 +16,13 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input\FileSelect
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class FileSelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIFileSelect';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = FileSelect::class;
|
||||
|
||||
/**
|
||||
@@ -28,7 +31,7 @@ class FileSelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\FileSelect\FileSelect A styled file input selector
|
||||
*/
|
||||
public static function MakeStandard(string $sName, string $sId = null): FileSelect
|
||||
public static function MakeStandard(string $sName, string $sId = null)
|
||||
{
|
||||
return new FileSelect($sName, $sId);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,12 @@ use Combodo\iTop\Application\UI\Base\Component\Field\Field;
|
||||
*/
|
||||
class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIInput';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Input::class;
|
||||
|
||||
public static function MakeForHidden(string $sName, string $sValue, ?string $sId = null): Input
|
||||
public static function MakeForHidden(string $sName, string $sValue, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Input($sId);
|
||||
|
||||
@@ -35,7 +37,7 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
public static function MakeStandard(string $sType, string $sName, string $sValue, ?string $sId = null): Input
|
||||
public static function MakeStandard(string $sType, string $sName, string $sValue, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Input($sId);
|
||||
|
||||
@@ -60,7 +62,7 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
public static function MakeForInputWithLabel(
|
||||
string $sLabel, string $sInputName, ?string $sInputValue = null,
|
||||
?string $sInputId = null, string $sInputType = 'type'
|
||||
): InputWithLabel
|
||||
)
|
||||
{
|
||||
$oInput = new Input($sInputId);
|
||||
$oInput->SetType($sInputType);
|
||||
|
||||
@@ -16,13 +16,16 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input\Select
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class SelectOptionUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UISelectOption';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = SelectOption::class;
|
||||
|
||||
public static function MakeForSelectOption(string $sValue, string $sLabel, bool $bSelected, ?string $sId = null): SelectOption
|
||||
public static function MakeForSelectOption(string $sValue, string $sLabel, bool $bSelected, ?string $sId = null)
|
||||
{
|
||||
$oInput = new SelectOption($sId);
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
|
||||
*/
|
||||
class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UISelect';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Select::class;
|
||||
|
||||
/**
|
||||
@@ -32,7 +34,7 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Select\Select
|
||||
*/
|
||||
public static function MakeForSelect(string $sName, ?string $sId = null): Select
|
||||
public static function MakeForSelect(string $sName, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Select($sId);
|
||||
$oInput->SetName($sName);
|
||||
@@ -51,7 +53,7 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Select\Select
|
||||
*/
|
||||
public static function MakeForSelectWithLabel(string $sName, string $sLabel, ?string $sId = null): Select
|
||||
public static function MakeForSelectWithLabel(string $sName, string $sLabel, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Select($sId);
|
||||
$oInput->SetName($sName);
|
||||
|
||||
@@ -24,10 +24,10 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
/**
|
||||
* Class PanelUIBlockFactory
|
||||
*
|
||||
* @internal
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Panel
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*
|
||||
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-panels to see live examples
|
||||
*/
|
||||
|
||||
@@ -16,10 +16,13 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Spinner
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UISpinner';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Spinner::class;
|
||||
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
|
||||
@@ -22,7 +22,9 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
*/
|
||||
class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UITitle';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Title::class;
|
||||
|
||||
public static function MakeForPage(string $sTitle, ?string $sId = null)
|
||||
|
||||
@@ -13,10 +13,10 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
/**
|
||||
* Class ToolbarSeparatorUIBlockFactory
|
||||
*
|
||||
* @api
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class ToolbarSeparatorUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
|
||||
@@ -20,7 +20,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
*/
|
||||
class ToolbarSpacerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIToolbarSpacer';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = ToolbarSpacer::class;
|
||||
|
||||
/**
|
||||
@@ -28,7 +30,7 @@ class ToolbarSpacerUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer\ToolbarSpacer
|
||||
*/
|
||||
public static function MakeStandard(string $sId = null): ToolbarSpacer
|
||||
public static function MakeStandard(string $sId = null)
|
||||
{
|
||||
return new ToolbarSpacer($sId);
|
||||
}
|
||||
|
||||
@@ -20,20 +20,22 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
*/
|
||||
class ToolbarUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIToolbar';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Toolbar::class;
|
||||
|
||||
public static function MakeForAction(string $sId = null): Toolbar
|
||||
public static function MakeForAction(string $sId = null)
|
||||
{
|
||||
return new Toolbar($sId, ['ibo-toolbar--action']);
|
||||
}
|
||||
|
||||
public static function MakeStandard(string $sId = null, array $aContainerClasses = []): Toolbar
|
||||
public static function MakeStandard(string $sId = null, array $aContainerClasses = [])
|
||||
{
|
||||
return new Toolbar($sId, $aContainerClasses);
|
||||
}
|
||||
|
||||
public static function MakeForButton(string $sId = null, array $aContainerClasses = []): Toolbar
|
||||
public static function MakeForButton(string $sId = null, array $aContainerClasses = [])
|
||||
{
|
||||
return new Toolbar($sId, array_merge($aContainerClasses, ['ibo-toolbar--button']));
|
||||
}
|
||||
|
||||
@@ -17,20 +17,23 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class ColumnUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIColumn';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Column::class;
|
||||
|
||||
public static function MakeStandard(?string $sId = null): Column
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
{
|
||||
$oInput = new Column($sId);
|
||||
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
public static function MakeForBlock(UIBlock $oBlock, ?string $sId = null): Column
|
||||
public static function MakeForBlock(UIBlock $oBlock, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Column($sId);
|
||||
$oInput->AddSubBlock($oBlock);
|
||||
|
||||
@@ -15,13 +15,16 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Layout\MultiColumn
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
class MultiColumnUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIMultiColumn';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = MultiColumn::class;
|
||||
|
||||
public static function MakeStandard(?string $sId = null): MultiColumn
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
{
|
||||
$oInput = new MultiColumn($sId);
|
||||
|
||||
|
||||
@@ -20,9 +20,19 @@ use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
*/
|
||||
class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public const TWIG_TAG_NAME = 'UIContentBlock';
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = UIContentBlock::class;
|
||||
|
||||
/**
|
||||
* Make an empty UIContentBlock which can be used to embed anything or to surround another block with specific CSS classes.
|
||||
*
|
||||
* @param string|null $sId
|
||||
* @param array $aContainerClasses
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock
|
||||
*/
|
||||
public static function MakeStandard(string $sId = null, array $aContainerClasses = [])
|
||||
{
|
||||
return new UIContentBlock($sId, $aContainerClasses);
|
||||
@@ -34,6 +44,8 @@ class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @param string $sCode
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock
|
||||
*/
|
||||
public static function MakeForCode(string $sCode, string $sId = null)
|
||||
{
|
||||
@@ -44,6 +56,14 @@ class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to display a block of preformatted text in a <pre> tag.
|
||||
*
|
||||
* @param string $sCode
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock
|
||||
*/
|
||||
public static function MakeForPreformatted(string $sCode, string $sId = null)
|
||||
{
|
||||
$sCode = '<pre>'.$sCode.'</pre>';
|
||||
|
||||
@@ -9,21 +9,30 @@ namespace Combodo\iTop\Application\UI\Base;
|
||||
|
||||
|
||||
/**
|
||||
* Interface UIBlockNode
|
||||
* Interface iUIBlockFactory
|
||||
*
|
||||
* The UIBlockFactories should be prefered rathan than manually instantiating UIBlocks via their constructor for several reasons:
|
||||
* * Factories' prototypes should be consistent over time
|
||||
* * Factories that a block style will be consistent with the whole app. UI style over time (eg. Success messages are displayed in green in the app. If you manually create a green one for your purpose, if in the future we change success messages to be blue, yours will stay green, loosing their semantic meaning. Using the factories properly, your usages will migrate with the app. UI style seemlessly)
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
interface iUIBlockFactory
|
||||
{
|
||||
/**
|
||||
* @return string TWIG tag name that will be associated with this factory
|
||||
* @used-by TWIG tags
|
||||
* @internal
|
||||
*/
|
||||
public static function GetTwigTagName(): string;
|
||||
|
||||
/**
|
||||
* @return string FQCN of the UIBlock produced by this factory
|
||||
* @used-by TWIG tags
|
||||
* @internal
|
||||
*/
|
||||
public static function GetUIBlockClassName(): string;
|
||||
}
|
||||
Reference in New Issue
Block a user