original_string: public function add_moodle_metadata() {
          global $CFG;
          if (!isset($this->groups['moodle'])) {
              throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
          }
  
          if (!isset($this->groups['moodle']['modules'])) {
              $this->groups['moodle']['modules'] = array();
          }
  
          $cache = cache::make('core', 'yuimodules');
          if (!isset($CFG->jsrev) || $CFG->jsrev == -1) {
              $metadata = array();
              $metadata = $this->get_moodle_metadata();
              $cache->delete('metadata');
          } else {
              // Attempt to get the metadata from the cache.
              if (!$metadata = $cache->get('metadata')) {
                  $metadata = $this->get_moodle_metadata();
                  $cache->set('metadata', $metadata);
              }
          }
  
          // Merge with any metadata added specific to this page which was added manually.
          $this->groups['moodle']['modules'] = array_merge($this->groups['moodle']['modules'],
                  $metadata);
      }
code: public function add_moodle_metadata() {
          global $CFG;
          if (!isset($this->groups['moodle'])) {
              throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
          }
  
          if (!isset($this->groups['moodle']['modules'])) {
              $this->groups['moodle']['modules'] = array();
          }
  
          $cache = cache::make('core', 'yuimodules');
          if (!isset($CFG->jsrev) || $CFG->jsrev == -1) {
              $metadata = array();
              $metadata = $this->get_moodle_metadata();
              $cache->delete('metadata');
          } else {
              // Attempt to get the metadata from the cache.
              if (!$metadata = $cache->get('metadata')) {
                  $metadata = $this->get_moodle_metadata();
                  $cache->set('metadata', $metadata);
              }
          }
  
          // Merge with any metadata added specific to this page which was added manually.
          $this->groups['moodle']['modules'] = array_merge($this->groups['moodle']['modules'],
                  $metadata);
      }
code_tokens: public function add_moodle_metadata ( ) { global $ CFG ; if ( ! isset ( $ this -> groups [ 'moodle' ] ) ) { throw new coding_exception ( 'The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.' ) ; } if ( ! isset ( $ this -> groups [ 'moodle' ] [ 'modules' ] ) ) { $ this -> groups [ 'moodle' ] [ 'modules' ] = array ( ) ; } $ cache = cache :: make ( 'core' , 'yuimodules' ) ; if ( ! isset ( $ CFG -> jsrev ) || $ CFG -> jsrev == - 1 ) { $ metadata = array ( ) ; $ metadata = $ this -> get_moodle_metadata ( ) ; $ cache -> delete ( 'metadata' ) ; } else { // Attempt to get the metadata from the cache. if ( ! $ metadata = $ cache -> get ( 'metadata' ) ) { $ metadata = $ this -> get_moodle_metadata ( ) ; $ cache -> set ( 'metadata' , $ metadata ) ; } } // Merge with any metadata added specific to this page which was added manually. $ this -> groups [ 'moodle' ] [ 'modules' ] = array_merge ( $ this -> groups [ 'moodle' ] [ 'modules' ] , $ metadata ) ; }
docstring: Add the moodle YUI module metadata for the moodle group to the YUI_config instance.
  
  If js caching is disabled, metadata will not be served causing YUI to calculate
  module dependencies as each module is loaded.
  
  If metadata does not exist it will be created and stored in a MUC entry.
  
  @return void
docstring_tokens: Add the moodle YUI module metadata for the moodle group to the YUI_config instance .