original_string: public function is_changeable($level = null) {
          if ($this->setting->get_status() === backup_setting::NOT_LOCKED) {
              // Its not locked so its chanegable.
              return true;
          } else if ($this->setting->get_status() !== backup_setting::LOCKED_BY_HIERARCHY) {
              // Its not changeable because its locked by permission or config.
              return false;
          } else if ($this->setting->has_dependencies_on_settings()) {
              foreach ($this->setting->get_settings_depended_on() as $dependency) {
                  if ($level && $dependency->get_setting()->get_level() >= $level) {
                      continue;
                  }
                  if ($dependency->is_locked() && $dependency->get_setting()->get_level() !== $this->setting->get_level()) {
                      // Its not changeable because one or more dependancies arn't changeable.
                      return false;
                  }
              }
              // Its changeable because all dependencies are changeable.
              return true;
          }
          // We should never get here but if we do return false to be safe.
          // The setting would need to be locked by hierarchy and not have any deps.
          return false;
      }
code: public function is_changeable($level = null) {
          if ($this->setting->get_status() === backup_setting::NOT_LOCKED) {
              // Its not locked so its chanegable.
              return true;
          } else if ($this->setting->get_status() !== backup_setting::LOCKED_BY_HIERARCHY) {
              // Its not changeable because its locked by permission or config.
              return false;
          } else if ($this->setting->has_dependencies_on_settings()) {
              foreach ($this->setting->get_settings_depended_on() as $dependency) {
                  if ($level && $dependency->get_setting()->get_level() >= $level) {
                      continue;
                  }
                  if ($dependency->is_locked() && $dependency->get_setting()->get_level() !== $this->setting->get_level()) {
                      // Its not changeable because one or more dependancies arn't changeable.
                      return false;
                  }
              }
              // Its changeable because all dependencies are changeable.
              return true;
          }
          // We should never get here but if we do return false to be safe.
          // The setting would need to be locked by hierarchy and not have any deps.
          return false;
      }
code_tokens: public function is_changeable ( $ level = null ) { if ( $ this -> setting -> get_status ( ) === backup_setting :: NOT_LOCKED ) { // Its not locked so its chanegable. return true ; } else if ( $ this -> setting -> get_status ( ) !== backup_setting :: LOCKED_BY_HIERARCHY ) { // Its not changeable because its locked by permission or config. return false ; } else if ( $ this -> setting -> has_dependencies_on_settings ( ) ) { foreach ( $ this -> setting -> get_settings_depended_on ( ) as $ dependency ) { if ( $ level && $ dependency -> get_setting ( ) -> get_level ( ) >= $ level ) { continue ; } if ( $ dependency -> is_locked ( ) && $ dependency -> get_setting ( ) -> get_level ( ) !== $ this -> setting -> get_level ( ) ) { // Its not changeable because one or more dependancies arn't changeable. return false ; } } // Its changeable because all dependencies are changeable. return true ; } // We should never get here but if we do return false to be safe. // The setting would need to be locked by hierarchy and not have any deps. return false ; }
docstring: Returns true if the setting is changeable.
  
  A setting is changeable if it meets either of the two following conditions.
  
  1. The setting is not locked
  2. The setting is locked but only by settings that are of the same level (same page)
  
  Condition 2 is really why we have this function
  @param int $level Optional, if provided only depedency_settings below or equal to this level are considered,
  when checking if the ui_setting is changeable. Although dependencies might cause a lock on this setting,
  they could be changeable in the same view.
  @return bool
docstring_tokens: Returns true if the setting is changeable .