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

Adjust widgets to support immutability #22

Merged
merged 13 commits into from Nov 30, 2020
Merged

Adjust widgets to support immutability #22

merged 13 commits into from Nov 30, 2020

Conversation

terabytesoftw
Copy link
Member

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues yiisoft/yii-bulma#20

@terabytesoftw terabytesoftw requested review from samdark and a team November 29, 2020 14:37
@terabytesoftw
Copy link
Member Author

terabytesoftw commented Nov 29, 2020

We have two types of widgets:

Widget simple:

$widget = MyWidget::widget();
$widget->render();

Widget begin/end:

$widget = MyWidget::begin();
$widget->start();
    // content
$widget->end();

@terabytesoftw
Copy link
Member Author

terabytesoftw commented Nov 29, 2020

Another variant but there will be a great BC:

We have two types of widgets:

Widget simple:

$widget = MyWidget::widget()->options(['class' => 'testMe']);
$widget->render();

Widget begin/end:

$widget = MyWidget::widget()->options(['class' => 'testMe']);
$widget->begin();
    // content
$widget->end();

or

MyWidget::widget()->options(['class' => 'testMe'])->begin();
    // content
MyWidget::end();

@samdark
Copy link
Member

samdark commented Nov 29, 2020

Do you mean:

$widget = MyWidget::widget()->option1(true)->option2(false);
$widget->begin();
    // content
$widget->end();

?

@terabytesoftw
Copy link
Member Author

Do you mean:

$widget = MyWidget::widget()->option1(true)->option2(false);
$widget->begin();
    // content
$widget->end();

?

yes.

@samdark
Copy link
Member

samdark commented Nov 29, 2020

In a template that would be:

<?php $widget = MyWidget::widget()->option1(true)->option2(false) ?>
<?= $widget->begin() ?>
    Content
<?= $widget->end() ?>

It could also be:

<?= MyWidget::widget()->options(['class' => 'testMe'])->begin() ?>
    // content
<?= MyWidget::end() ?>

@terabytesoftw
Copy link
Member Author

In a template that would be:

<?php $widget = MyWidget::widget()->option1(true)->option2(false) ?>
<?= $widget->begin() ?>
    Content
<?= $widget->end() ?>

It could also be:

<?= MyWidget::widget()->options(['class' => 'testMe'])->begin() ?>
    // content
<?= MyWidget::end() ?>

yes, i have added the test.

tests/WidgetTest.php Show resolved Hide resolved
tests/WidgetTest.php Show resolved Hide resolved
tests/WidgetTest.php Outdated Show resolved Hide resolved
tests/WidgetTest.php Outdated Show resolved Hide resolved
tests/WidgetTest.php Outdated Show resolved Hide resolved
tests/WidgetTest.php Outdated Show resolved Hide resolved
@samdark samdark mentioned this pull request Nov 29, 2020
@samdark samdark added the type:bug Bug label Nov 29, 2020
@samdark samdark marked this pull request as ready for review November 30, 2020 12:50
@samdark samdark added the status:code review The pull request needs review. label Nov 30, 2020
@samdark samdark changed the title Add tests inmutable widgets. Adjust widgets to support immutability Nov 30, 2020
@terabytesoftw
Copy link
Member Author

terabytesoftw commented Nov 30, 2020

@samdark Please check I think all the PRs that BC will do in the repositories are ready, are there any missing ?

@samdark
Copy link
Member

samdark commented Nov 30, 2020

  • auth-client
  • dataview
  • yii-widgets

I'll fix these.

@samdark samdark merged commit 0fede76 into yiisoft:master Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review. type:bug Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants