mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°4621 Fix naming inconsistencies in sources/*
This commit is contained in:
88
sources/Application/UI/Base/Component/Input/tInputLabel.php
Normal file
88
sources/Application/UI/Base/Component/Input/tInputLabel.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
/**
|
||||
* Trait tInputLabel Label for input
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
||||
*/
|
||||
trait tInputLabel
|
||||
{
|
||||
/** @var bool If true the label will be positioned before the input */
|
||||
protected $bIsLabelBefore = true;
|
||||
/** @var string|null Label to display with the input (null for no label) */
|
||||
protected $sLabel = null;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsLabelBefore(): bool
|
||||
{
|
||||
return $this->bIsLabelBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bIsLabelBefore {@see tInputLabel::$bIsLabelBefore}
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsLabelBefore(bool $bIsLabelBefore)
|
||||
{
|
||||
$this->bIsLabelBefore = $bIsLabelBefore;
|
||||
if ($this->bIsLabelBefore) {
|
||||
$this->AddCSSClass('ibo-input--label-left');
|
||||
$this->RemoveCSSClass('ibo-input--label-right');
|
||||
} else {
|
||||
$this->AddCSSClass('ibo-input--label-right');
|
||||
$this->RemoveCSSClass('ibo-input--label-left');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function GetLabel(): ?string
|
||||
{
|
||||
return $this->sLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $sLabel {@see tInputLabel::$sLabel}
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetLabel(?string $sLabel)
|
||||
{
|
||||
$this->sLabel = $sLabel;
|
||||
if (!is_null($sLabel)) {
|
||||
if ($this->bIsLabelBefore) {
|
||||
$this->AddCSSClass('ibo-input--label-left');
|
||||
$this->RemoveCSSClass('ibo-input--label-right');
|
||||
} else {
|
||||
$this->AddCSSClass('ibo-input--label-right');
|
||||
$this->RemoveCSSClass('ibo-input--label-left');
|
||||
}
|
||||
} else {
|
||||
$this->RemoveCSSClass('ibo-input--label-right');
|
||||
$this->RemoveCSSClass('ibo-input--label-left');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function HasLabel(): bool
|
||||
{
|
||||
return $this->sLabel != null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user