Skip to content

Commit

Permalink
Merge pull request #22 from boboldehampsink/fix_beforesave
Browse files Browse the repository at this point in the history
Check if allowedLinkNames is actually an array before treating it like one
  • Loading branch information
sebastian-lenz authored Jun 5, 2018
2 parents 7996099 + eebc549 commit f43c850
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/fields/LinkField.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ class LinkField extends Field
* @return bool
*/
public function beforeSave(bool $isNew): bool {
$this->allowedLinkNames = array_filter($this->allowedLinkNames);
foreach ($this->allowedLinkNames as $linkName) {
if ($linkName === '*') {
$this->allowedLinkNames = '*';
break;
if (is_array($this->allowedLinkNames)) {
$this->allowedLinkNames = array_filter($this->allowedLinkNames);
foreach ($this->allowedLinkNames as $linkName) {
if ($linkName === '*') {
$this->allowedLinkNames = '*';
break;
}
}
}

Expand Down

0 comments on commit f43c850

Please sign in to comment.