for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the WPFoundation library.
*
* Copyright (c) 2015 LIN3S <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LIN3S\WPFoundation\Configuration\Acf;
/**
* Custom ACF Wysiwyg class adding some useful features.
* @author Beñat Espiña <[email protected]>
* @author Jon Torrado <[email protected]>
class Wysiwyg
{
* Constructor.
* @param array $toolbars Array which contains toolbar
public function __construct($toolbars)
$this->toolbars = $toolbars;
toolbars
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
add_filter('acf/fields/wysiwyg/toolbars', [$this, 'toolbars']);
add_filter()
}
* Callback method that manages the Wysiwyg toolbars.
* @param array $toolbars Array which contains the toolbars
* @return array
public function toolbars(array $toolbars)
return array_merge($toolbars, $this->toolbars);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: