mirror of
https://github.com/humhub/humhub.git
synced 2025-04-20 23:21:54 +02:00
Remove help text for Yii captcha and widgets about BS5 migration
This commit is contained in:
parent
6065c027d4
commit
05a65cd03e
@ -107,8 +107,6 @@ $this->pageTitle = Yii::t('UserModule.auth', 'Login');
|
||||
<?= $form->field($invite, 'email')->input('email', ['id' => 'register-email', 'placeholder' => $invite->getAttributeLabel('email'), 'aria-label' => $invite->getAttributeLabel('email')])->label(false); ?>
|
||||
<?php if ($invite->showCaptureInRegisterForm()) : ?>
|
||||
<div id="registration-form-captcha" style="display: none;">
|
||||
<div><?= Yii::t('UserModule.auth', 'Please enter the letters from the image.'); ?></div>
|
||||
|
||||
<?= $form->field($invite, 'captcha')->widget(Yii::$app->params['captcha']['inputClass'])->label(false) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -122,7 +122,6 @@ use yii\helpers\Url;
|
||||
|
||||
<?= $form->field($invite, 'email')->input('email', ['id' => 'register-email', 'placeholder' => $invite->getAttributeLabel('email')]); ?>
|
||||
<?php if ($invite->showCaptureInRegisterForm()) : ?>
|
||||
<div><?= Yii::t('UserModule.auth', 'Please enter the letters from the image.'); ?></div>
|
||||
<?= $form->field($invite, 'captcha')->widget(Yii::$app->params['captcha']['inputClass'])->label(false) ?>
|
||||
<?php endif; ?>
|
||||
<hr>
|
||||
|
@ -42,8 +42,6 @@ $this->pageTitle = Yii::t('UserModule.auth', 'Create Account');
|
||||
<?= $form->field($invite, 'email')->input('email', ['id' => 'register-email', 'placeholder' => $invite->getAttributeLabel('email'), 'aria-label' => $invite->getAttributeLabel('email')])->label(false); ?>
|
||||
<?php if ($invite->showCaptureInRegisterForm()) : ?>
|
||||
<div id="registration-form-captcha" style="display: none;">
|
||||
<div><?= Yii::t('UserModule.auth', 'Please enter the letters from the image.'); ?></div>
|
||||
|
||||
<?= $form->field($invite, 'captcha')->widget(Yii::$app->params['captcha']['inputClass'])->label(false) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -1,466 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*
|
||||
*/
|
||||
|
||||
namespace humhub\widgets;
|
||||
|
||||
use humhub\components\Widget;
|
||||
use humhub\helpers\Html;
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
use Yii;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* BootstrapComponent is an abstract class used to define bootstrap based ui components and provides common
|
||||
* features as sizing, color, text and alignment configuration.
|
||||
*
|
||||
* This class follows the builder pattern for instantiation and configuration. By default this class provides the following
|
||||
* static initializers:
|
||||
*
|
||||
* - none
|
||||
* - primary
|
||||
* - secondary
|
||||
* - info
|
||||
* - warn
|
||||
* - danger
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* // Set only text
|
||||
* BootstrapComponent::instance('My Label')->right();
|
||||
*
|
||||
* // Component with primary color and text
|
||||
* BootstrapComponent::primary('My Label');
|
||||
* ```
|
||||
*
|
||||
* @deprecated since 1.18
|
||||
*
|
||||
* @package humhub\widgets
|
||||
*/
|
||||
abstract class BootstrapComponent extends Widget
|
||||
{
|
||||
public const TYPE_PRIMARY = 'primary';
|
||||
/**
|
||||
* @deprecated since 1.18
|
||||
*/
|
||||
public const TYPE_DEFAULT = self::TYPE_SECONDARY;
|
||||
public const TYPE_SECONDARY = 'secondary';
|
||||
public const TYPE_INFO = 'info';
|
||||
public const TYPE_WARNING = 'warning';
|
||||
public const TYPE_DANGER = 'danger';
|
||||
public const TYPE_SUCCESS = 'success';
|
||||
public const TYPE_LIGHT = 'light';
|
||||
public const TYPE_DARK = 'dark';
|
||||
public const TYPE_NONE = 'none';
|
||||
|
||||
public $type;
|
||||
public $htmlOptions = [];
|
||||
public $text;
|
||||
public $encode = false;
|
||||
public $_icon;
|
||||
public $_iconRight;
|
||||
|
||||
public $_visible = true;
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function instance($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_NONE, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function none($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_NONE, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function primary($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_PRIMARY, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.18
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function defaultType($text = null)
|
||||
{
|
||||
return self::light($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function secondary($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_SECONDARY, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function info($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_INFO, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function warning($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_WARNING, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function success($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_SUCCESS, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function danger($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_DANGER, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function light($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_LIGHT, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text Button text
|
||||
* @return static
|
||||
*/
|
||||
public static function dark($text = null)
|
||||
{
|
||||
return new static(['type' => self::TYPE_DARK, 'text' => $text]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $color
|
||||
* @param null $text
|
||||
* @return $this
|
||||
*/
|
||||
public static function asColor($color, $text = null)
|
||||
{
|
||||
return static::info($text)->color($color);
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $text
|
||||
* @return $this
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $right
|
||||
* @return $this
|
||||
*/
|
||||
public function right($right = true)
|
||||
{
|
||||
if ($right) {
|
||||
Html::removeCssClass($this->htmlOptions, 'float-start');
|
||||
Html::addCssClass($this->htmlOptions, 'float-end');
|
||||
} else {
|
||||
Html::removeCssClass($this->htmlOptions, 'float-end');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $left
|
||||
* @return $this
|
||||
*/
|
||||
public function left($left = true)
|
||||
{
|
||||
if ($left) {
|
||||
Html::removeCssClass($this->htmlOptions, 'float-end');
|
||||
Html::addCssClass($this->htmlOptions, 'float-start');
|
||||
} else {
|
||||
Html::removeCssClass($this->htmlOptions, 'float-start');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function sm()
|
||||
{
|
||||
Html::addCssClass($this->htmlOptions, 'btn-sm');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function lg()
|
||||
{
|
||||
Html::addCssClass($this->htmlOptions, 'btn-lg');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.18
|
||||
* @return $this
|
||||
*/
|
||||
public function xs()
|
||||
{
|
||||
return $this->sm();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $style
|
||||
* @return $this
|
||||
*/
|
||||
public function style($style)
|
||||
{
|
||||
Html::addCssStyle($this->htmlOptions, $style);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return $this
|
||||
*/
|
||||
public function id($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an html title attribute
|
||||
* @param $title
|
||||
* @return $this
|
||||
* @since 1.3
|
||||
*/
|
||||
public function title($title)
|
||||
{
|
||||
return $this->options(['title' => $title]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an title + tooltip behaviour class
|
||||
* @param $id
|
||||
* @return $this
|
||||
* @since 1.3
|
||||
*/
|
||||
public function tooltip($title)
|
||||
{
|
||||
return $this->title($title)->cssClass('tt');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $cssClass
|
||||
* @return $this
|
||||
*/
|
||||
public function cssClass($cssClass)
|
||||
{
|
||||
Html::addCssClass($this->htmlOptions, $cssClass);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $options
|
||||
* @return $this
|
||||
*/
|
||||
public function options($options)
|
||||
{
|
||||
if (isset($options['class'])) {
|
||||
$this->cssClass($options['class']);
|
||||
unset($options['class']);
|
||||
}
|
||||
|
||||
if (isset($options['style'])) {
|
||||
$this->style($options['style']);
|
||||
unset($options['style']);
|
||||
}
|
||||
|
||||
$this->htmlOptions = ArrayHelper::merge($this->htmlOptions, $options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $content
|
||||
* @param bool $right
|
||||
* @param bool $raw
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function icon($content, $right = false, $raw = false)
|
||||
{
|
||||
if (!empty($content)) {
|
||||
if (!$raw) {
|
||||
$this->icon(Icon::get($content)->right($right)->asString(), $right, true);
|
||||
} else {
|
||||
$this->_icon = $content;
|
||||
$this->_iconRight = $right;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->setCssClass();
|
||||
|
||||
if ($this->getId(false)) {
|
||||
$this->htmlOptions['id'] = $this->getId(false);
|
||||
}
|
||||
|
||||
return $this->renderComponent();
|
||||
}
|
||||
|
||||
public function color($color)
|
||||
{
|
||||
if ($color) {
|
||||
$this->style('background-color:' . $color);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function textColor($color)
|
||||
{
|
||||
$this->style('color:' . $color);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string renders and returns the actual html element by means of the current settings
|
||||
*/
|
||||
abstract public function renderComponent();
|
||||
|
||||
/**
|
||||
* @return string the bootstrap css base class
|
||||
*/
|
||||
abstract public function getComponentBaseClass();
|
||||
|
||||
/**
|
||||
* @return string the bootstrap css class by $type
|
||||
*/
|
||||
abstract public function getTypedClass($type);
|
||||
|
||||
protected function setCssClass()
|
||||
{
|
||||
if ($this->type !== self::TYPE_NONE) {
|
||||
Html::addCssClass($this->htmlOptions, $this->getComponentBaseClass());
|
||||
Html::addCssClass($this->htmlOptions, $this->getTypedClass($this->type));
|
||||
}
|
||||
}
|
||||
|
||||
protected function getText()
|
||||
{
|
||||
$text = ($this->encode) ? Html::encode($this->text) : $this->text;
|
||||
if ($this->_icon) {
|
||||
return ($this->_iconRight) ? $text . ' ' . $this->_icon : $this->_icon . ' ' . $text;
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
public function visible($isVisible = true)
|
||||
{
|
||||
$this->_visible = $isVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 1.4
|
||||
*/
|
||||
public function asString()
|
||||
{
|
||||
return (string) $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
try {
|
||||
$result = $this::widget($this->getWidgetOptions());
|
||||
return $result ?: '';
|
||||
} catch (\Exception $e) {
|
||||
Yii::error($e);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array all options required for rendering the widget
|
||||
*/
|
||||
public function getWidgetOptions()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'text' => $this->text,
|
||||
'htmlOptions' => $this->htmlOptions,
|
||||
'encode' => $this->encode,
|
||||
'_icon' => $this->_icon,
|
||||
'_iconRight' => $this->_iconRight,
|
||||
'render' => $this->_visible,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*
|
||||
*/
|
||||
|
||||
namespace humhub\widgets;
|
||||
|
||||
use humhub\helpers\Html;
|
||||
|
||||
/**
|
||||
* Labels for Wall Entries
|
||||
* This widget will attached labels like Pinned, Archived to Wall Entries
|
||||
*
|
||||
* @deprecated since 1.18, use [[\humhub\widgets\bootstrap\Badge]] instead
|
||||
* @since 1.2.2
|
||||
*/
|
||||
class Label extends BootstrapComponent
|
||||
{
|
||||
|
||||
public $_sortOrder = 1000;
|
||||
public $encode = true;
|
||||
|
||||
public $_link;
|
||||
public $_action;
|
||||
|
||||
|
||||
public function sortOrder($sortOrder)
|
||||
{
|
||||
$this->_sortOrder = $sortOrder;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a data-action-click handler to the button.
|
||||
* @param $handler
|
||||
* @param null $url
|
||||
* @param null $target
|
||||
* @return static
|
||||
*/
|
||||
public function action($handler, $url = null, $target = null)
|
||||
{
|
||||
$this->_link = Link::withAction($this->getText(), $handler, $url, $target);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withLink($link)
|
||||
{
|
||||
if ($link instanceof Link) {
|
||||
$this->_link = $link;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string renders and returns the actual html element by means of the current settings
|
||||
*/
|
||||
public function renderComponent()
|
||||
{
|
||||
$result = Html::tag('span', $this->getText(), $this->htmlOptions);
|
||||
if ($this->_link) {
|
||||
$result = (string) $this->_link->setText($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the bootstrap css base class
|
||||
*/
|
||||
public function getComponentBaseClass()
|
||||
{
|
||||
return 'label';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the bootstrap css class by $type
|
||||
*/
|
||||
public function getTypedClass($type)
|
||||
{
|
||||
return 'label-' . $type;
|
||||
}
|
||||
|
||||
public function getWidgetOptions()
|
||||
{
|
||||
$options = parent::getWidgetOptions();
|
||||
$options['_link'] = $this->_link;
|
||||
return $options;
|
||||
}
|
||||
|
||||
public static function sort(&$labels)
|
||||
{
|
||||
usort($labels, function ($a, $b) {
|
||||
if ($a->_sortOrder == $b->_sortOrder) {
|
||||
return 0;
|
||||
} elseif ($a->_sortOrder < $b->_sortOrder) {
|
||||
return - 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
return $labels;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user