original_string: protected function preload_contexts(array $contextids) {
          global $DB;
  
          if (empty($contextids)) {
              return;
          }
  
          $ctxfields = \context_helper::get_preload_record_columns_sql('ctx');
          list($insql, $inparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED);
          $sql = "SELECT {$ctxfields} FROM {context} ctx WHERE ctx.id {$insql}";
          $contextlist = $DB->get_recordset_sql($sql, $inparams);
          foreach ($contextlist as $contextdata) {
              \context_helper::preload_from_record($contextdata);
          }
          $contextlist->close();
  
      }
code: protected function preload_contexts(array $contextids) {
          global $DB;
  
          if (empty($contextids)) {
              return;
          }
  
          $ctxfields = \context_helper::get_preload_record_columns_sql('ctx');
          list($insql, $inparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED);
          $sql = "SELECT {$ctxfields} FROM {context} ctx WHERE ctx.id {$insql}";
          $contextlist = $DB->get_recordset_sql($sql, $inparams);
          foreach ($contextlist as $contextdata) {
              \context_helper::preload_from_record($contextdata);
          }
          $contextlist->close();
  
      }
code_tokens: protected function preload_contexts ( array $ contextids ) { global $ DB ; if ( empty ( $ contextids ) ) { return ; } $ ctxfields = \ context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ contextids , SQL_PARAMS_NAMED ) ; $ sql = "SELECT {$ctxfields} FROM {context} ctx WHERE ctx.id {$insql}" ; $ contextlist = $ DB -> get_recordset_sql ( $ sql , $ inparams ) ; foreach ( $ contextlist as $ contextdata ) { \ context_helper :: preload_from_record ( $ contextdata ) ; } $ contextlist -> close ( ) ; }
docstring: Preload context records given a set of contextids.
  
  @param   array   $contextids
docstring_tokens: Preload context records given a set of contextids .