Use explicit code instead of PHP magic
[MAILPOET-1798]
This commit is contained in:
committed by
Jack Kitterhing
parent
8da7330a8d
commit
831a865c9e
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
|
use MailPoet\Entities\FormEntity;
|
||||||
use MailPoet\Form\FormsRepository;
|
use MailPoet\Form\FormsRepository;
|
||||||
use MailPoet\Form\Widget;
|
use MailPoet\Form\Widget;
|
||||||
use MailPoet\WP\Functions as WPFunctions;
|
use MailPoet\WP\Functions as WPFunctions;
|
||||||
@ -72,7 +73,9 @@ class PostEditorBlock {
|
|||||||
$forms = $this->formsRepository->findAllNotDeleted();
|
$forms = $this->formsRepository->findAllNotDeleted();
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.mailpoet_forms = <?php echo json_encode($forms) ?>;
|
window.mailpoet_forms = <?php echo json_encode(array_map(function(FormEntity $form) {
|
||||||
|
return $form->toArray();
|
||||||
|
}, $forms)) ?>;
|
||||||
window.locale = {
|
window.locale = {
|
||||||
selectForm: '<?php echo __('Select a MailPoet form', 'mailpoet') ?>',
|
selectForm: '<?php echo __('Select a MailPoet form', 'mailpoet') ?>',
|
||||||
createForm: '<?php echo __('Create a new form', 'mailpoet') ?>',
|
createForm: '<?php echo __('Create a new form', 'mailpoet') ?>',
|
||||||
|
@ -12,7 +12,7 @@ use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
|||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
* @ORM\Table(name="forms")
|
* @ORM\Table(name="forms")
|
||||||
*/
|
*/
|
||||||
class FormEntity implements \JsonSerializable {
|
class FormEntity {
|
||||||
use AutoincrementedIdTrait;
|
use AutoincrementedIdTrait;
|
||||||
use CreatedAtTrait;
|
use CreatedAtTrait;
|
||||||
use UpdatedAtTrait;
|
use UpdatedAtTrait;
|
||||||
@ -102,7 +102,7 @@ class FormEntity implements \JsonSerializable {
|
|||||||
$this->styles = $styles;
|
$this->styles = $styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize() {
|
public function toArray() {
|
||||||
return [
|
return [
|
||||||
'id' => $this->getId(),
|
'id' => $this->getId(),
|
||||||
'name' => $this->getName(),
|
'name' => $this->getName(),
|
||||||
|
Reference in New Issue
Block a user