-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a70f25b
commit 3cd1d08
Showing
7 changed files
with
73 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
|
||
namespace PServerCMS\View\Helper; | ||
|
||
use Zend\Form\ElementInterface; | ||
use Zend\Form\View\Helper\FormLabel as OriginalFormLabel; | ||
|
||
class FormLabel extends OriginalFormLabel | ||
{ | ||
/** @var ElementInterface */ | ||
protected $element; | ||
|
||
/** | ||
* @param ElementInterface|null $element | ||
* @param null $labelContent | ||
* @param null $position | ||
* @return string|OriginalFormLabel | ||
*/ | ||
public function __invoke(ElementInterface $element = null, $labelContent = null, $position = null) | ||
{ | ||
$this->element = $element; | ||
|
||
return parent::__invoke($element, $labelContent, $position); | ||
} | ||
|
||
/** | ||
* Return a closing label tag | ||
* | ||
* @return string | ||
*/ | ||
public function closeTag() | ||
{ | ||
$result = '</label>'; | ||
if ($this->element->hasAttribute('required') && $this->element->getAttribute('required')) { | ||
$result = sprintf('<span class="required-mark">*</span> %s', $result); | ||
} | ||
|
||
return $result; | ||
} | ||
} |