...
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->directory = $sources['packages'];
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/'.PKG_NAME_LOWER.'/');
...
Name: mypackage
Core path: {core_path}components/mypackage/
Assets path: /var/www/modx/wwwRoot/development/mypackage/assets/components/mypackage/
Assets path: {assets_path}components/mypackage/
This question has been answered by multiple community members. See the first response.
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/'.PKG_NAME_LOWER.'/');$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/'.PKG_NAME_LOWER.'/', '{assets_path}components/'.PKG_NAME_LOWER.'/');
public function registerNamespace($ns = 'core', $autoincludes = true, $packageNamespace = true, $path = '',$assetsPath = '') {
if (!($ns instanceof modNamespace)) {
$namespace = $this->modx->getObject('modNamespace', $ns);
if (!$namespace) {
$namespace = $this->modx->newObject('modNamespace');
$namespace->set('name', $ns);
$namespace->set('path',$path);
$namespace->set('assets_path',$assetsPath);
}
if (!empty($path)) {
$namespace->set('path',$path);
}
if (!empty($assetsPath)) {
$namespace->set('assets_path',$assetsPath);
}
...
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/'.PKG_NAME_LOWER.'/');
No, unless you're using it yourself. Many add-on packages leave it blank.
