original_string: public function define_form_specific($form) {
          // Get the current calendar in use - see MDL-18375.
          $calendartype = \core_calendar\type_factory::get_calendar_instance();
  
          // Create variables to store start and end.
          list($year, $month, $day) = explode('_', date('Y_m_d'));
          $currentdate = $calendartype->convert_from_gregorian($year, $month, $day);
          $currentyear = $currentdate['year'];
  
          $arryears = $calendartype->get_years();
  
          // Add elements.
          $form->addElement('select', 'param1', get_string('startyear', 'profilefield_datetime'), $arryears);
          $form->setType('param1', PARAM_INT);
          $form->setDefault('param1', $currentyear);
  
          $form->addElement('select', 'param2', get_string('endyear', 'profilefield_datetime'), $arryears);
          $form->setType('param2', PARAM_INT);
          $form->setDefault('param2', $currentyear);
  
          $form->addElement('checkbox', 'param3', get_string('wanttime', 'profilefield_datetime'));
          $form->setType('param3', PARAM_INT);
  
          $form->addElement('hidden', 'startday', '1');
          $form->setType('startday', PARAM_INT);
          $form->addElement('hidden', 'startmonth', '1');
          $form->setType('startmonth', PARAM_INT);
          $form->addElement('hidden', 'startyear', '1');
          $form->setType('startyear', PARAM_INT);
          $form->addElement('hidden', 'endday', '1');
          $form->setType('endday', PARAM_INT);
          $form->addElement('hidden', 'endmonth', '1');
          $form->setType('endmonth', PARAM_INT);
          $form->addElement('hidden', 'endyear', '1');
          $form->setType('endyear', PARAM_INT);
          $form->addElement('hidden', 'defaultdata', '0');
          $form->setType('defaultdata', PARAM_INT);
      }
code: public function define_form_specific($form) {
          // Get the current calendar in use - see MDL-18375.
          $calendartype = \core_calendar\type_factory::get_calendar_instance();
  
          // Create variables to store start and end.
          list($year, $month, $day) = explode('_', date('Y_m_d'));
          $currentdate = $calendartype->convert_from_gregorian($year, $month, $day);
          $currentyear = $currentdate['year'];
  
          $arryears = $calendartype->get_years();
  
          // Add elements.
          $form->addElement('select', 'param1', get_string('startyear', 'profilefield_datetime'), $arryears);
          $form->setType('param1', PARAM_INT);
          $form->setDefault('param1', $currentyear);
  
          $form->addElement('select', 'param2', get_string('endyear', 'profilefield_datetime'), $arryears);
          $form->setType('param2', PARAM_INT);
          $form->setDefault('param2', $currentyear);
  
          $form->addElement('checkbox', 'param3', get_string('wanttime', 'profilefield_datetime'));
          $form->setType('param3', PARAM_INT);
  
          $form->addElement('hidden', 'startday', '1');
          $form->setType('startday', PARAM_INT);
          $form->addElement('hidden', 'startmonth', '1');
          $form->setType('startmonth', PARAM_INT);
          $form->addElement('hidden', 'startyear', '1');
          $form->setType('startyear', PARAM_INT);
          $form->addElement('hidden', 'endday', '1');
          $form->setType('endday', PARAM_INT);
          $form->addElement('hidden', 'endmonth', '1');
          $form->setType('endmonth', PARAM_INT);
          $form->addElement('hidden', 'endyear', '1');
          $form->setType('endyear', PARAM_INT);
          $form->addElement('hidden', 'defaultdata', '0');
          $form->setType('defaultdata', PARAM_INT);
      }
code_tokens: public function define_form_specific ( $ form ) { // Get the current calendar in use - see MDL-18375. $ calendartype = \ core_calendar \ type_factory :: get_calendar_instance ( ) ; // Create variables to store start and end. list ( $ year , $ month , $ day ) = explode ( '_' , date ( 'Y_m_d' ) ) ; $ currentdate = $ calendartype -> convert_from_gregorian ( $ year , $ month , $ day ) ; $ currentyear = $ currentdate [ 'year' ] ; $ arryears = $ calendartype -> get_years ( ) ; // Add elements. $ form -> addElement ( 'select' , 'param1' , get_string ( 'startyear' , 'profilefield_datetime' ) , $ arryears ) ; $ form -> setType ( 'param1' , PARAM_INT ) ; $ form -> setDefault ( 'param1' , $ currentyear ) ; $ form -> addElement ( 'select' , 'param2' , get_string ( 'endyear' , 'profilefield_datetime' ) , $ arryears ) ; $ form -> setType ( 'param2' , PARAM_INT ) ; $ form -> setDefault ( 'param2' , $ currentyear ) ; $ form -> addElement ( 'checkbox' , 'param3' , get_string ( 'wanttime' , 'profilefield_datetime' ) ) ; $ form -> setType ( 'param3' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'startday' , '1' ) ; $ form -> setType ( 'startday' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'startmonth' , '1' ) ; $ form -> setType ( 'startmonth' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'startyear' , '1' ) ; $ form -> setType ( 'startyear' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'endday' , '1' ) ; $ form -> setType ( 'endday' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'endmonth' , '1' ) ; $ form -> setType ( 'endmonth' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'endyear' , '1' ) ; $ form -> setType ( 'endyear' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'defaultdata' , '0' ) ; $ form -> setType ( 'defaultdata' , PARAM_INT ) ; }
docstring: Define the setting for a datetime custom field.
  
  @param moodleform $form the user form
docstring_tokens: Define the setting for a datetime custom field .