Skip to content

Container::addHidden Allow any type so it works same as setDefaultValue - #245

Merged
dg merged 1 commit into
nette:masterfrom
dakorpar:patch-1
May 8, 2020
Merged

Container::addHidden Allow any type so it works same as setDefaultValue#245
dg merged 1 commit into
nette:masterfrom
dakorpar:patch-1

Conversation

@dakorpar

@dakorpar dakorpar commented May 8, 2020

Copy link
Copy Markdown
Contributor
  • BC break? no

If setDefaultValue can receive any type then this should be supported in addHidden method as well.
Now it's strange that you cannot do this:

$this->addHidden('count', 0);

but you can do:

$this->addHidden('count')->setDefaultValue(5);

@dg

dg commented May 8, 2020

Copy link
Copy Markdown
Member

Thanks

@dg dg changed the title Allow any type for addHidden so it works same as setDefaultValue Container::addHidden Allow any type so it works same as setDefaultValue May 8, 2020
@dg
dg merged commit bba2500 into nette:master May 8, 2020
@dakorpar
dakorpar deleted the patch-1 branch May 8, 2020 17:29
@dakujem

dakujem commented Jun 9, 2020

Copy link
Copy Markdown

@dakorpar This is a BC Break! It changes the method's signature.

Just try extending the method so that it is compatible with the previous version, then update:

Declaration of ExtendedContainer::addHidden(string $name, ?string $default = NULL): Nette\Forms\Controls\HiddenField should be compatible with Nette\Forms\Container::addHidden(string $name, $default = NULL): Nette\Forms\Controls\HiddenField

Please mark this in the changelog/release notes as such @dg

@dg

dg commented Jun 9, 2020

Copy link
Copy Markdown
Member

Done

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

Successfully merging this pull request may close these issues.

3 participants