for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Get more out of your WidgetAreaEditor
* @package cms
* @subpackage content
* @author nicolaas [at] sunnysideup.co.nz
*/
class WidgetAreaEditorExtended extends WidgetAreaEditor
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
protected $availableWidgets = array();
protected $blockedWidgets = array();
public function addToAvailableWidgets($array)
if (!is_array($array)) {
user_error("first and only argument for WidgetAreaEditor::addToAvailableWidgets must be an array", E_USER_ERROR);
}
$this->availableWidgets = $array;
public function blockFromAvailableWidgets($array)
user_error("first and only argument for WidgetAreaEditor::blockFromAvailableWidgets must be an array", E_USER_ERROR);
$this->blockedWidgets = $array;
public function AvailableWidgets()
$classes = ClassInfo::subclassesFor('Widget');
array_shift($classes);
$widgets= new ArrayList();
$hasSpecificallyAddedWidgets = count($this->availableWidgets) && is_array($this->availableWidgets);
$hasSpecificallyBlockedWidgets = count($this->blockedWidgets) && is_array($this->blockedWidgets);
foreach ($classes as $class) {
if ($hasSpecificallyAddedWidgets) {
if (!in_array($class, $this->availableWidgets)) {
$class = '';
if ($hasSpecificallyBlockedWidgets) {
if (in_array($class, $this->blockedWidgets)) {
if ($class) {
$widgets->push(singleton($class));
return $widgets;
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.