original_string: protected function apply_admin_locked_flags() {
          global $OUTPUT;
  
          if (!$this->applyadminlockedflags) {
              return;
          }
  
          $settings = get_config($this->_modname);
          $mform = $this->_form;
          $lockedicon = html_writer::tag('span',
                                         $OUTPUT->pix_icon('t/locked', get_string('locked', 'admin')),
                                         array('class' => 'action-icon'));
          $isupdate = !empty($this->_cm);
  
          foreach ($settings as $name => $value) {
              if (strpos('_', $name) !== false) {
                  continue;
              }
              if ($mform->elementExists($name)) {
                  $element = $mform->getElement($name);
                  $lockedsetting = $name . '_locked';
                  if (!empty($settings->$lockedsetting)) {
                      // Always lock locked settings for new modules,
                      // for updates, only lock them if the current value is the same as the default (or there is no current value).
                      $value = $settings->$name;
                      if ($isupdate && isset($this->current->$name)) {
                          $value = $this->current->$name;
                      }
                      if ($value == $settings->$name) {
                          $mform->setConstant($name, $settings->$name);
                          $element->setLabel($element->getLabel() . $lockedicon);
                          // Do not use hardfreeze because we need the hidden input to check dependencies.
                          $element->freeze();
                      }
                  }
              }
          }
      }
code: protected function apply_admin_locked_flags() {
          global $OUTPUT;
  
          if (!$this->applyadminlockedflags) {
              return;
          }
  
          $settings = get_config($this->_modname);
          $mform = $this->_form;
          $lockedicon = html_writer::tag('span',
                                         $OUTPUT->pix_icon('t/locked', get_string('locked', 'admin')),
                                         array('class' => 'action-icon'));
          $isupdate = !empty($this->_cm);
  
          foreach ($settings as $name => $value) {
              if (strpos('_', $name) !== false) {
                  continue;
              }
              if ($mform->elementExists($name)) {
                  $element = $mform->getElement($name);
                  $lockedsetting = $name . '_locked';
                  if (!empty($settings->$lockedsetting)) {
                      // Always lock locked settings for new modules,
                      // for updates, only lock them if the current value is the same as the default (or there is no current value).
                      $value = $settings->$name;
                      if ($isupdate && isset($this->current->$name)) {
                          $value = $this->current->$name;
                      }
                      if ($value == $settings->$name) {
                          $mform->setConstant($name, $settings->$name);
                          $element->setLabel($element->getLabel() . $lockedicon);
                          // Do not use hardfreeze because we need the hidden input to check dependencies.
                          $element->freeze();
                      }
                  }
              }
          }
      }
code_tokens: protected function apply_admin_locked_flags ( ) { global $ OUTPUT ; if ( ! $ this -> applyadminlockedflags ) { return ; } $ settings = get_config ( $ this -> _modname ) ; $ mform = $ this -> _form ; $ lockedicon = html_writer :: tag ( 'span' , $ OUTPUT -> pix_icon ( 't/locked' , get_string ( 'locked' , 'admin' ) ) , array ( 'class' => 'action-icon' ) ) ; $ isupdate = ! empty ( $ this -> _cm ) ; foreach ( $ settings as $ name => $ value ) { if ( strpos ( '_' , $ name ) !== false ) { continue ; } if ( $ mform -> elementExists ( $ name ) ) { $ element = $ mform -> getElement ( $ name ) ; $ lockedsetting = $ name . '_locked' ; if ( ! empty ( $ settings -> $ lockedsetting ) ) { // Always lock locked settings for new modules, // for updates, only lock them if the current value is the same as the default (or there is no current value). $ value = $ settings -> $ name ; if ( $ isupdate && isset ( $ this -> current -> $ name ) ) { $ value = $ this -> current -> $ name ; } if ( $ value == $ settings -> $ name ) { $ mform -> setConstant ( $ name , $ settings -> $ name ) ; $ element -> setLabel ( $ element -> getLabel ( ) . $ lockedicon ) ; // Do not use hardfreeze because we need the hidden input to check dependencies. $ element -> freeze ( ) ; } } } } }
docstring: Get the list of admin settings for this module and apply any locked settings.
  This cannot happen in apply_admin_defaults because we do not the current values of the settings
  in that function because set_data has not been called yet.
  
  @return void
docstring_tokens: Get the list of admin settings for this module and apply any locked settings . This cannot happen in apply_admin_defaults because we do not the current values of the settings in that function because set_data has not been called yet .