public function initialize()
    {
        if (true == $this->initialized) {
            return;
        }

        $this->initialized = true;
        
        if ($this->isEnabled()) {
            $headScript = $this->getView()->plugin('headScript');
            
            $headScript->prependFile($this->src);
            
            $options = array();
            foreach (array('async', 'parseOnLoad') as $property) {
                if (null !== $this->$property) {
                    $options[$property] = $this->$property;
                }
            }
            if (!empty($this->packages)) {
                $options['packages'] = array_values($this->packages);
            }
            if (!empty($options)) {
                $headScript->prependScript("dojoConfig=" . json_encode($options) . ";");
            }
            if (!empty($this->modules)) {
                $require = 'require(["' . implode('", "', $this->modules) . '"]);';
                $headScript->appendScript($require);
            }
        }
    }