Hi,
I’m developing a component on MODx and i’ve setup a directory structure like so:
core/components/mycomponent/lexicon/en/
This works perfectly, when i’m going into the Lexicon management MODx sees my namespace
and loads up the default lexicon file "default.inc.php". I can overwrite my lexicon
entries as expected.
But here’s the kicker, when i create a new topic file...say "test.inc.php" and write
some values in it this topic is not selectable in the MODx lexicon manager.
This also doesn’t work for the "login" component. I’ve read the topic about the major
change in the lexicon management, and if i read correctly...this should work the way
i’m doing this right?
The topic select box isn’t reacting at all, no events are being fired.
Thanks in advance,
b03tz.
[edit]
I’ve just did some testing and when i open up "modlexicon.class.php" there’s
a function called "getTopicList" which iterates over the topic directory like so:
$corePath = $this->getNamespacePath($namespace);
$lexPath = str_replace('//','/',$corePath.'/lexicon/'.$language.'/');
$topics = array();
if (!is_dir($lexPath)) return $topics;
If i echo $lexPath it shows an unprocessed: {core_path} in the string...shouldn’t
this be the actual corepath?
A hotfix for this would be:
public function getNamespacePath($namespace = 'core') {
$corePath = $this->modx->getOption('core_path',null,MODX_CORE_PATH);
if ($namespace != 'core') {
$namespaceObj = $this->modx->getObject('modNamespace',$namespace);
if ($namespaceObj) {
// Changed this line:
// $corePath = $namespaceObj->get('path');
// To this
$corePath = str_replace('{core_path}', $corePath, $namespaceObj->get('path'));
}
}
return $corePath;
}
[/edit]