Ejemplo n.º 1
0
 /**
  * Returns the name of the plugin that defines the given subplugin type
  *
  * If the given subplugin type is not actually a subplugin, returns false.
  *
  * @param string $subplugintype the name of subplugin type, eg. workshopform or quiz
  * @return false|string the name of the parent plugin, eg. mod_workshop
  */
 public function get_parent_of_subplugin($subplugintype)
 {
     $parent = core_component::get_subtype_parent($subplugintype);
     if (!$parent) {
         return false;
     }
     return $parent;
 }
Ejemplo n.º 2
0
 public function test_get_subtype_parent()
 {
     global $CFG;
     $this->assertNull(core_component::get_subtype_parent('mod'));
     // Any plugin with more subtypes is ok here.
     $this->assertFileExists("{$CFG->dirroot}/mod/assign/db/subplugins.php");
     $this->assertSame('mod_assign', core_component::get_subtype_parent('assignsubmission'));
     $this->assertSame('mod_assign', core_component::get_subtype_parent('assignfeedback'));
     $this->assertNull(core_component::get_subtype_parent('assignxxxxx'));
 }