Display form only if it is enabled

[MAILPOET-3075]
This commit is contained in:
Pavel Dohnal
2020-08-11 09:41:44 +02:00
committed by Veljko V
parent 51aa4055c9
commit ca8831e5bb
2 changed files with 11 additions and 1 deletions

View File

@ -118,6 +118,13 @@ class FormEntity {
$this->styles = $styles; $this->styles = $styles;
} }
/**
* @param string $status
*/
public function setStatus(string $status) {
$this->status = $status;
}
public function toArray(): array { public function toArray(): array {
return [ return [
'id' => $this->getId(), 'id' => $this->getId(),

View File

@ -109,7 +109,10 @@ class DisplayFormInWPContent {
* @return array<string, FormEntity> * @return array<string, FormEntity>
*/ */
private function getForms(): array { private function getForms(): array {
$forms = $this->formsRepository->findBy(['deletedAt' => null], ['updatedAt' => 'ASC']); $forms = $this->formsRepository->findBy([
'deletedAt' => null,
'status' => FormEntity::STATUS_ENABLED,
], ['updatedAt' => 'ASC']);
$forms = $this->filterOneFormInEachDisplayType($forms); $forms = $this->filterOneFormInEachDisplayType($forms);
return $forms; return $forms;
} }