original_string: public static function message_processor_config_form($userid, $name, $formvalues) {
          global $USER, $CFG;
  
          // Check if messaging is enabled.
          if (empty($CFG->messaging)) {
              throw new moodle_exception('disabled', 'message');
          }
  
          $params = self::validate_parameters(
              self::message_processor_config_form_parameters(),
              array(
                  'userid' => $userid,
                  'name' => $name,
                  'formvalues' => $formvalues,
              )
          );
  
          $user = self::validate_preferences_permissions($params['userid']);
  
          $processor = get_message_processor($params['name']);
          $preferences = [];
          $form = new stdClass();
  
          foreach ($params['formvalues'] as $formvalue) {
              // Curly braces to ensure interpretation is consistent between
              // php 5 and php 7.
              $form->{$formvalue['name']} = $formvalue['value'];
          }
  
          $processor->process_form($form, $preferences);
  
          if (!empty($preferences)) {
              set_user_preferences($preferences, $params['userid']);
          }
      }
code: public static function message_processor_config_form($userid, $name, $formvalues) {
          global $USER, $CFG;
  
          // Check if messaging is enabled.
          if (empty($CFG->messaging)) {
              throw new moodle_exception('disabled', 'message');
          }
  
          $params = self::validate_parameters(
              self::message_processor_config_form_parameters(),
              array(
                  'userid' => $userid,
                  'name' => $name,
                  'formvalues' => $formvalues,
              )
          );
  
          $user = self::validate_preferences_permissions($params['userid']);
  
          $processor = get_message_processor($params['name']);
          $preferences = [];
          $form = new stdClass();
  
          foreach ($params['formvalues'] as $formvalue) {
              // Curly braces to ensure interpretation is consistent between
              // php 5 and php 7.
              $form->{$formvalue['name']} = $formvalue['value'];
          }
  
          $processor->process_form($form, $preferences);
  
          if (!empty($preferences)) {
              set_user_preferences($preferences, $params['userid']);
          }
      }
code_tokens: public static function message_processor_config_form ( $ userid , $ name , $ formvalues ) { global $ USER , $ CFG ; // Check if messaging is enabled. if ( empty ( $ CFG -> messaging ) ) { throw new moodle_exception ( 'disabled' , 'message' ) ; } $ params = self :: validate_parameters ( self :: message_processor_config_form_parameters ( ) , array ( 'userid' => $ userid , 'name' => $ name , 'formvalues' => $ formvalues , ) ) ; $ user = self :: validate_preferences_permissions ( $ params [ 'userid' ] ) ; $ processor = get_message_processor ( $ params [ 'name' ] ) ; $ preferences = [ ] ; $ form = new stdClass ( ) ; foreach ( $ params [ 'formvalues' ] as $ formvalue ) { // Curly braces to ensure interpretation is consistent between // php 5 and php 7. $ form -> { $ formvalue [ 'name' ] } = $ formvalue [ 'value' ] ; } $ processor -> process_form ( $ form , $ preferences ) ; if ( ! empty ( $ preferences ) ) { set_user_preferences ( $ preferences , $ params [ 'userid' ] ) ; } }
docstring: Processes a message processor config form.
  
  @param  int $userid the user id
  @param  string $name the name of the processor
  @param  array $formvalues the form values
  @return external_description
  @throws moodle_exception
  @since 3.2
docstring_tokens: Processes a message processor config form .