Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yii2 advanced template and Bootstrap 5 #373

Open
numitec opened this issue Nov 1, 2022 · 1 comment
Open

Yii2 advanced template and Bootstrap 5 #373

numitec opened this issue Nov 1, 2022 · 1 comment

Comments

@numitec
Copy link

numitec commented Nov 1, 2022

Hello there,

just a question about the Bootstrap requirements: I've installed a vanilla Yii2 advanced template and now it comes with BS5; is there a version of Multiple Input compatible?

I've tried with latest 2.7.0 and TabularInput.php uses:

use yii\bootstrap\Widget;

Thank you and really appreciate your work.

S.

@numitec
Copy link
Author

numitec commented Nov 3, 2022

In order to use it, albeit in a untidy and lazy way, I've changed TableRenderer:

    private function renderAddButton()
    {
		$pathOptions = [
			'd' => 'M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z'
		];

		$svgOptions = [
			'xmlns' => 'http://www.w3.org/2000/svg',
			'width' => 24,
			'height' => 24,
			'fill' => 'green',
			'class' => 'bi bi-plus-circle-fill multiple-input-list__btn js-input-plus',
			'viewBox' => '0 0 16 16'
		];

		$html = Html::beginTag( 'a', [ 'href' => '#' ] );
		$html.= Html::beginTag( 'svg', $svgOptions );
		$html.= Html::tag( 'path', Null, $pathOptions );
		$html.= Html::endTag( 'svg' );
		$html.= Html::endTag( 'a' );

		return $html;
    }
    private function renderRemoveButton()
    {
		$pathOptions = [
			'd' => 'M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z'
		];

		$svgOptions = [
			'xmlns' => 'http://www.w3.org/2000/svg',
			'width' => 24,
			'height' => 24,
			'fill' => 'red',
			'class' => 'bi-x-circle-fill multiple-input-list__btn js-input-remove',
			'viewBox' => '0 0 16 16'
		];

		$html = Html::beginTag( 'a', [ 'href' => '#' ] );
		$html.= Html::beginTag( 'svg', $svgOptions );
		$html.= Html::tag( 'path', Null, $pathOptions );
		$html.= Html::endTag( 'svg' );
		$html.= Html::endTag( 'a' );

		return $html;
    }

It works but sorry the messy code...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant