We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2611
    • 394 Posts
    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]
      Follow me on twitter: @b03tz
      Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
      CodeMaster
      • 28215
      • 4,149 Posts
      Can you file that as a bug in JIRA? http://bugs.modxcms.com/
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 2611
        • 394 Posts
        I’ve just posted this in JIRA: http://svn.modxcms.com/jira/browse/MODX-2085
          Follow me on twitter: @b03tz
          Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
          CodeMaster
          • 2611
          • 394 Posts
          Yay, it’s fixed already in r7007 ....

          Good good!
            Follow me on twitter: @b03tz
            Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
            CodeMaster