original_string: public static function get_activity_options($nodefaults) {
          $warnings = [];
  
          $params = self::validate_parameters(self::get_activity_options_parameters(), [
              'nodefaults' => $nodefaults,
          ]);
          $nodefaults = $params['nodefaults'];
  
          $context = context_system::instance();
          self::validate_context($context);
  
          // Get activity module plugin info.
          $pluginmanager = \core_plugin_manager::instance();
          $modplugins = $pluginmanager->get_enabled_plugins('mod');
          $modoptions = [];
  
          // Get the module-level defaults. data_registry::get_defaults falls back to this when there are no activity defaults.
          list($levelpurpose, $levelcategory) = data_registry::get_defaults(CONTEXT_MODULE);
          foreach ($modplugins as $name) {
              // Check if we have default purpose and category for this module if we want don't want to fetch everything.
              if ($nodefaults) {
                  list($purpose, $category) = data_registry::get_defaults(CONTEXT_MODULE, $name);
                  // Compare this with the module-level defaults.
                  if ($purpose !== $levelpurpose || $category !== $levelcategory) {
                      // If the defaults for this activity has been already set, there's no need to add this in the list of options.
                      continue;
                  }
              }
  
              $displayname = $pluginmanager->plugin_name('mod_' . $name);
              $modoptions[] = (object)[
                  'name' => $name,
                  'displayname' => $displayname
              ];
          }
  
          return [
              'options' => $modoptions,
              'warnings' => $warnings
          ];
      }
code: public static function get_activity_options($nodefaults) {
          $warnings = [];
  
          $params = self::validate_parameters(self::get_activity_options_parameters(), [
              'nodefaults' => $nodefaults,
          ]);
          $nodefaults = $params['nodefaults'];
  
          $context = context_system::instance();
          self::validate_context($context);
  
          // Get activity module plugin info.
          $pluginmanager = \core_plugin_manager::instance();
          $modplugins = $pluginmanager->get_enabled_plugins('mod');
          $modoptions = [];
  
          // Get the module-level defaults. data_registry::get_defaults falls back to this when there are no activity defaults.
          list($levelpurpose, $levelcategory) = data_registry::get_defaults(CONTEXT_MODULE);
          foreach ($modplugins as $name) {
              // Check if we have default purpose and category for this module if we want don't want to fetch everything.
              if ($nodefaults) {
                  list($purpose, $category) = data_registry::get_defaults(CONTEXT_MODULE, $name);
                  // Compare this with the module-level defaults.
                  if ($purpose !== $levelpurpose || $category !== $levelcategory) {
                      // If the defaults for this activity has been already set, there's no need to add this in the list of options.
                      continue;
                  }
              }
  
              $displayname = $pluginmanager->plugin_name('mod_' . $name);
              $modoptions[] = (object)[
                  'name' => $name,
                  'displayname' => $displayname
              ];
          }
  
          return [
              'options' => $modoptions,
              'warnings' => $warnings
          ];
      }
code_tokens: public static function get_activity_options ( $ nodefaults ) { $ warnings = [ ] ; $ params = self :: validate_parameters ( self :: get_activity_options_parameters ( ) , [ 'nodefaults' => $ nodefaults , ] ) ; $ nodefaults = $ params [ 'nodefaults' ] ; $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; // Get activity module plugin info. $ pluginmanager = \ core_plugin_manager :: instance ( ) ; $ modplugins = $ pluginmanager -> get_enabled_plugins ( 'mod' ) ; $ modoptions = [ ] ; // Get the module-level defaults. data_registry::get_defaults falls back to this when there are no activity defaults. list ( $ levelpurpose , $ levelcategory ) = data_registry :: get_defaults ( CONTEXT_MODULE ) ; foreach ( $ modplugins as $ name ) { // Check if we have default purpose and category for this module if we want don't want to fetch everything. if ( $ nodefaults ) { list ( $ purpose , $ category ) = data_registry :: get_defaults ( CONTEXT_MODULE , $ name ) ; // Compare this with the module-level defaults. if ( $ purpose !== $ levelpurpose || $ category !== $ levelcategory ) { // If the defaults for this activity has been already set, there's no need to add this in the list of options. continue ; } } $ displayname = $ pluginmanager -> plugin_name ( 'mod_' . $ name ) ; $ modoptions [ ] = ( object ) [ 'name' => $ name , 'displayname' => $ displayname ] ; } return [ 'options' => $ modoptions , 'warnings' => $ warnings ] ; }
docstring: Fetches a list of activity options for setting data registry defaults.
  
  @param boolean $nodefaults If false, it will fetch all of the activities. Otherwise, it will only fetch the activities
  that don't have defaults yet (e.g. when adding a new activity module defaults).
  @return array
docstring_tokens: Fetches a list of activity options for setting data registry defaults .