Hey guys,
I had set up MIGX Configurator Custom Manager Page (CMP) using the default class map and it was working in my backend menu bar.
Original class.php
class packageName extends xPDOSimpleObject {}
My Menu Settings
Lexicon Key: My Package
Action: index
Parameters: &configs=packageName
Namespace: migx
I then extended my package and created some public functions. However, it will not load the package in my menu anymore.
class packageName extends xPDOSimpleObject {
/**
* @access public
* @var modX A reference to the modX object.
*/
public $modx = null;
/**
* @access public
* @var array A collection of properties to adjust SFL Countries behaviour.
*/
public $config = array();
function __construct(modX & $modx, array $config = array()) {
$this->modx = &$modx;
$packageName = 'packageName';
$packagepath = $this->modx->getOption('core_path') . 'components/' . $packageName . '/';
$modelpath = $packagepath . 'model/';
$prefix = null;
$this->modx->addPackage($packageName, $modelpath, $prefix);
$corePath = $this->modx->getOption('packageName.core_path', null, $modx->getOption('core_path') . 'components/' . $packageName . '/');
$defaultconfig['corePath'] = $corePath;
$defaultconfig['modelPath'] = $corePath . 'model/';
$this->config = array_merge($defaultconfig, $config);
}
public function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
// trim
$text = trim($text, '-');
// remove duplicate -
$text = preg_replace('~-+~', '-', $text);
// lowercase
$text = strtolower($text);
if (empty($text)) {
return 'n-a';
}
return $text;
}
}
It seems I’m missing something from my constructor. Can anyone help?