Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
25 changed files
with
499 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/** | ||
* YAWIK | ||
* | ||
* @filesource | ||
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) | ||
* @license MIT | ||
*/ | ||
namespace Core\Form; | ||
|
||
/** | ||
* | ||
* @author fedys | ||
* @since 0.26 | ||
*/ | ||
trait EmptySummaryAwareTrait | ||
{ | ||
|
||
/** | ||
* The empty summary notice. | ||
* | ||
* @var string | ||
*/ | ||
protected $emptySummaryNotice; | ||
|
||
/** | ||
* @see \Core\Form\EmptySummaryAwareInterface::isSummaryEmpty() | ||
*/ | ||
public function isSummaryEmpty() | ||
{ | ||
foreach ($this as $element) { /* @var $element \Zend\Form\ElementInterface */ | ||
if ($element->getValue()) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* @see \Core\Form\EmptySummaryAwareInterface::setEmptySummaryNotice() | ||
*/ | ||
public function setEmptySummaryNotice($message) | ||
{ | ||
$this->emptySummaryNotice = $message; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @see \Core\Form\EmptySummaryAwareInterface::getEmptySummaryNotice() | ||
*/ | ||
public function getEmptySummaryNotice() | ||
{ | ||
if (! isset($this->emptySummaryNotice)) { | ||
$this->emptySummaryNotice = $this->getDefaultEmptySummaryNotice(); | ||
} | ||
|
||
return $this->emptySummaryNotice; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getDefaultEmptySummaryNotice() | ||
{ | ||
return ''; | ||
} | ||
} |
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
Oops, something went wrong.