Skip to content

Commit

Permalink
Added isSet() method to DataItem.
Browse files Browse the repository at this point in the history
  • Loading branch information
joachim-n committed Sep 17, 2024
1 parent a066eb1 commit 76d43e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Data/DataItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,23 @@ public function unset(): void {
*/
abstract public function isEmpty(): bool;

/**
* Determines whether the data has a value set.
*
* This will return TRUE if the data has been set to a value that is
* considered empty.
*
* This method can be used to distinguish between a data item that has been
* instantiated by a UI to optain its label and description, and one that has
* has data entered by the user.
*
* @return bool
* TRUE if set, FALSE if not.
*/
public function isSet(): bool {
return (bool) $this->set;
}

/**
* Gets the value as a plain array.
*
Expand Down

0 comments on commit 76d43e7

Please sign in to comment.