original_string: public static function get_edit_store_form($plugin, $store) {
          global $CFG; // Needed for includes.
          $plugins = core_component::get_plugin_list('cachestore');
          if (!array_key_exists($plugin, $plugins)) {
              throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');
          }
          $factory = cache_factory::instance();
          $config = $factory->create_config_instance();
          $stores = $config->get_all_stores();
          if (!array_key_exists($store, $stores)) {
              throw new coding_exception('Invalid store name given when trying to create an edit form.');
          }
          $plugindir = $plugins[$plugin];
          $class = 'cachestore_addinstance_form';
          if (file_exists($plugindir.'/addinstanceform.php')) {
              require_once($plugindir.'/addinstanceform.php');
              if (class_exists('cachestore_'.$plugin.'_addinstance_form')) {
                  $class = 'cachestore_'.$plugin.'_addinstance_form';
                  if (!array_key_exists('cachestore_addinstance_form', class_parents($class))) {
                      throw new coding_exception('Cache plugin add instance forms must extend cachestore_addinstance_form');
                  }
              }
          }
  
          $locks = self::get_possible_locks_for_stores($plugindir, $plugin);
  
          $url = new moodle_url('/cache/admin.php', array('action' => 'editstore', 'plugin' => $plugin, 'store' => $store));
          $editform = new $class($url, array('plugin' => $plugin, 'store' => $store, 'locks' => $locks));
          if (isset($stores[$store]['lock'])) {
              $editform->set_data(array('lock' => $stores[$store]['lock']));
          }
          // See if the cachestore is going to want to load data for the form.
          // If it has a customised add instance form then it is going to want to.
          $storeclass = 'cachestore_'.$plugin;
          $storedata = $stores[$store];
          if (array_key_exists('configuration', $storedata) && array_key_exists('cache_is_configurable', class_implements($storeclass))) {
              $storeclass::config_set_edit_form_data($editform, $storedata['configuration']);
          }
          return $editform;
      }
code: public static function get_edit_store_form($plugin, $store) {
          global $CFG; // Needed for includes.
          $plugins = core_component::get_plugin_list('cachestore');
          if (!array_key_exists($plugin, $plugins)) {
              throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');
          }
          $factory = cache_factory::instance();
          $config = $factory->create_config_instance();
          $stores = $config->get_all_stores();
          if (!array_key_exists($store, $stores)) {
              throw new coding_exception('Invalid store name given when trying to create an edit form.');
          }
          $plugindir = $plugins[$plugin];
          $class = 'cachestore_addinstance_form';
          if (file_exists($plugindir.'/addinstanceform.php')) {
              require_once($plugindir.'/addinstanceform.php');
              if (class_exists('cachestore_'.$plugin.'_addinstance_form')) {
                  $class = 'cachestore_'.$plugin.'_addinstance_form';
                  if (!array_key_exists('cachestore_addinstance_form', class_parents($class))) {
                      throw new coding_exception('Cache plugin add instance forms must extend cachestore_addinstance_form');
                  }
              }
          }
  
          $locks = self::get_possible_locks_for_stores($plugindir, $plugin);
  
          $url = new moodle_url('/cache/admin.php', array('action' => 'editstore', 'plugin' => $plugin, 'store' => $store));
          $editform = new $class($url, array('plugin' => $plugin, 'store' => $store, 'locks' => $locks));
          if (isset($stores[$store]['lock'])) {
              $editform->set_data(array('lock' => $stores[$store]['lock']));
          }
          // See if the cachestore is going to want to load data for the form.
          // If it has a customised add instance form then it is going to want to.
          $storeclass = 'cachestore_'.$plugin;
          $storedata = $stores[$store];
          if (array_key_exists('configuration', $storedata) && array_key_exists('cache_is_configurable', class_implements($storeclass))) {
              $storeclass::config_set_edit_form_data($editform, $storedata['configuration']);
          }
          return $editform;
      }
code_tokens: public static function get_edit_store_form ( $ plugin , $ store ) { global $ CFG ; // Needed for includes. $ plugins = core_component :: get_plugin_list ( 'cachestore' ) ; if ( ! array_key_exists ( $ plugin , $ plugins ) ) { throw new coding_exception ( 'Invalid cache plugin used when trying to create an edit form.' ) ; } $ factory = cache_factory :: instance ( ) ; $ config = $ factory -> create_config_instance ( ) ; $ stores = $ config -> get_all_stores ( ) ; if ( ! array_key_exists ( $ store , $ stores ) ) { throw new coding_exception ( 'Invalid store name given when trying to create an edit form.' ) ; } $ plugindir = $ plugins [ $ plugin ] ; $ class = 'cachestore_addinstance_form' ; if ( file_exists ( $ plugindir . '/addinstanceform.php' ) ) { require_once ( $ plugindir . '/addinstanceform.php' ) ; if ( class_exists ( 'cachestore_' . $ plugin . '_addinstance_form' ) ) { $ class = 'cachestore_' . $ plugin . '_addinstance_form' ; if ( ! array_key_exists ( 'cachestore_addinstance_form' , class_parents ( $ class ) ) ) { throw new coding_exception ( 'Cache plugin add instance forms must extend cachestore_addinstance_form' ) ; } } } $ locks = self :: get_possible_locks_for_stores ( $ plugindir , $ plugin ) ; $ url = new moodle_url ( '/cache/admin.php' , array ( 'action' => 'editstore' , 'plugin' => $ plugin , 'store' => $ store ) ) ; $ editform = new $ class ( $ url , array ( 'plugin' => $ plugin , 'store' => $ store , 'locks' => $ locks ) ) ; if ( isset ( $ stores [ $ store ] [ 'lock' ] ) ) { $ editform -> set_data ( array ( 'lock' => $ stores [ $ store ] [ 'lock' ] ) ) ; } // See if the cachestore is going to want to load data for the form. // If it has a customised add instance form then it is going to want to. $ storeclass = 'cachestore_' . $ plugin ; $ storedata = $ stores [ $ store ] ; if ( array_key_exists ( 'configuration' , $ storedata ) && array_key_exists ( 'cache_is_configurable' , class_implements ( $ storeclass ) ) ) { $ storeclass :: config_set_edit_form_data ( $ editform , $ storedata [ 'configuration' ] ) ; } return $ editform ; }
docstring: Returns a form that can be used to edit a store instance.
  
  @param string $plugin
  @param string $store
  @return cachestore_addinstance_form
  @throws coding_exception
docstring_tokens: Returns a form that can be used to edit a store instance .