original_string: public function define_form_common(&$form) {
  
          $strrequired = get_string('required');
  
          // Accepted values for 'shortname' would follow [a-zA-Z0-9_] pattern,
          // but we are accepting any PARAM_TEXT value here,
          // and checking [a-zA-Z0-9_] pattern in define_validate_common() function to throw an error when needed.
          $form->addElement('text', 'shortname', get_string('profileshortname', 'admin'), 'maxlength="100" size="25"');
          $form->addRule('shortname', $strrequired, 'required', null, 'client');
          $form->setType('shortname', PARAM_TEXT);
  
          $form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="50"');
          $form->addRule('name', $strrequired, 'required', null, 'client');
          $form->setType('name', PARAM_TEXT);
  
          $form->addElement('editor', 'description', get_string('profiledescription', 'admin'), null, null);
  
          $form->addElement('selectyesno', 'required', get_string('profilerequired', 'admin'));
  
          $form->addElement('selectyesno', 'locked', get_string('profilelocked', 'admin'));
  
          $form->addElement('selectyesno', 'forceunique', get_string('profileforceunique', 'admin'));
  
          $form->addElement('selectyesno', 'signup', get_string('profilesignup', 'admin'));
  
          $choices = array();
          $choices[PROFILE_VISIBLE_NONE]    = get_string('profilevisiblenone', 'admin');
          $choices[PROFILE_VISIBLE_PRIVATE] = get_string('profilevisibleprivate', 'admin');
          $choices[PROFILE_VISIBLE_ALL]     = get_string('profilevisibleall', 'admin');
          $form->addElement('select', 'visible', get_string('profilevisible', 'admin'), $choices);
          $form->addHelpButton('visible', 'profilevisible', 'admin');
          $form->setDefault('visible', PROFILE_VISIBLE_ALL);
  
          $choices = profile_list_categories();
          $form->addElement('select', 'categoryid', get_string('profilecategory', 'admin'), $choices);
      }
code: public function define_form_common(&$form) {
  
          $strrequired = get_string('required');
  
          // Accepted values for 'shortname' would follow [a-zA-Z0-9_] pattern,
          // but we are accepting any PARAM_TEXT value here,
          // and checking [a-zA-Z0-9_] pattern in define_validate_common() function to throw an error when needed.
          $form->addElement('text', 'shortname', get_string('profileshortname', 'admin'), 'maxlength="100" size="25"');
          $form->addRule('shortname', $strrequired, 'required', null, 'client');
          $form->setType('shortname', PARAM_TEXT);
  
          $form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="50"');
          $form->addRule('name', $strrequired, 'required', null, 'client');
          $form->setType('name', PARAM_TEXT);
  
          $form->addElement('editor', 'description', get_string('profiledescription', 'admin'), null, null);
  
          $form->addElement('selectyesno', 'required', get_string('profilerequired', 'admin'));
  
          $form->addElement('selectyesno', 'locked', get_string('profilelocked', 'admin'));
  
          $form->addElement('selectyesno', 'forceunique', get_string('profileforceunique', 'admin'));
  
          $form->addElement('selectyesno', 'signup', get_string('profilesignup', 'admin'));
  
          $choices = array();
          $choices[PROFILE_VISIBLE_NONE]    = get_string('profilevisiblenone', 'admin');
          $choices[PROFILE_VISIBLE_PRIVATE] = get_string('profilevisibleprivate', 'admin');
          $choices[PROFILE_VISIBLE_ALL]     = get_string('profilevisibleall', 'admin');
          $form->addElement('select', 'visible', get_string('profilevisible', 'admin'), $choices);
          $form->addHelpButton('visible', 'profilevisible', 'admin');
          $form->setDefault('visible', PROFILE_VISIBLE_ALL);
  
          $choices = profile_list_categories();
          $form->addElement('select', 'categoryid', get_string('profilecategory', 'admin'), $choices);
      }
code_tokens: public function define_form_common ( & $ form ) { $ strrequired = get_string ( 'required' ) ; // Accepted values for 'shortname' would follow [a-zA-Z0-9_] pattern, // but we are accepting any PARAM_TEXT value here, // and checking [a-zA-Z0-9_] pattern in define_validate_common() function to throw an error when needed. $ form -> addElement ( 'text' , 'shortname' , get_string ( 'profileshortname' , 'admin' ) , 'maxlength="100" size="25"' ) ; $ form -> addRule ( 'shortname' , $ strrequired , 'required' , null , 'client' ) ; $ form -> setType ( 'shortname' , PARAM_TEXT ) ; $ form -> addElement ( 'text' , 'name' , get_string ( 'profilename' , 'admin' ) , 'size="50"' ) ; $ form -> addRule ( 'name' , $ strrequired , 'required' , null , 'client' ) ; $ form -> setType ( 'name' , PARAM_TEXT ) ; $ form -> addElement ( 'editor' , 'description' , get_string ( 'profiledescription' , 'admin' ) , null , null ) ; $ form -> addElement ( 'selectyesno' , 'required' , get_string ( 'profilerequired' , 'admin' ) ) ; $ form -> addElement ( 'selectyesno' , 'locked' , get_string ( 'profilelocked' , 'admin' ) ) ; $ form -> addElement ( 'selectyesno' , 'forceunique' , get_string ( 'profileforceunique' , 'admin' ) ) ; $ form -> addElement ( 'selectyesno' , 'signup' , get_string ( 'profilesignup' , 'admin' ) ) ; $ choices = array ( ) ; $ choices [ PROFILE_VISIBLE_NONE ] = get_string ( 'profilevisiblenone' , 'admin' ) ; $ choices [ PROFILE_VISIBLE_PRIVATE ] = get_string ( 'profilevisibleprivate' , 'admin' ) ; $ choices [ PROFILE_VISIBLE_ALL ] = get_string ( 'profilevisibleall' , 'admin' ) ; $ form -> addElement ( 'select' , 'visible' , get_string ( 'profilevisible' , 'admin' ) , $ choices ) ; $ form -> addHelpButton ( 'visible' , 'profilevisible' , 'admin' ) ; $ form -> setDefault ( 'visible' , PROFILE_VISIBLE_ALL ) ; $ choices = profile_list_categories ( ) ; $ form -> addElement ( 'select' , 'categoryid' , get_string ( 'profilecategory' , 'admin' ) , $ choices ) ; }
docstring: Prints out the form snippet for the part of creating or editing a profile field common to all data types.
  
  @param moodleform $form instance of the moodleform class
docstring_tokens: Prints out the form snippet for the part of creating or editing a profile field common to all data types .