Skip to content

Commit a00cf2d

Browse files
committed
BaseControl: added method getControlPart() and getLabelPart() which by default returns the same as getControl() and getLabel() BC break
1 parent b2078aa commit a00cf2d

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/Forms/Controls/BaseControl.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,24 @@ public function getLabel($caption = NULL)
265265
}
266266

267267

268+
/**
269+
* @return Nette\Utils\Html|NULL
270+
*/
271+
public function getControlPart()
272+
{
273+
return $this->getControl();
274+
}
275+
276+
277+
/**
278+
* @return Nette\Utils\Html|NULL
279+
*/
280+
public function getLabelPart()
281+
{
282+
return $this->getLabel();
283+
}
284+
285+
268286
/**
269287
* Returns control's HTML element template.
270288
* @return Html

src/Forms/Controls/CheckboxList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getLabel($caption = NULL)
8181
/**
8282
* @return Html
8383
*/
84-
public function getControlPart($key)
84+
public function getControlPart($key = NULL)
8585
{
8686
$key = key([(string) $key => NULL]);
8787
return parent::getControl()->addAttributes([

src/Forms/Controls/RadioList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getLabel($caption = NULL)
9393
/**
9494
* @return Html
9595
*/
96-
public function getControlPart($key)
96+
public function getControlPart($key = NULL)
9797
{
9898
$key = key([(string) $key => NULL]);
9999
return parent::getControl()->addAttributes([

0 commit comments

Comments
 (0)