original_string: protected function validate_parentid($value) {
  
          // Check that the parent exists. But only if we don't have it already, and we actually have a parent.
          if (!empty($value) && !$this->newparent && !self::record_exists($value)) {
              return new lang_string('invaliddata', 'error');
          }
  
          // During update.
          if ($this->get('id')) {
  
              // If there is a new parent.
              if ($this->beforeupdate->get('parentid') != $value && $this->newparent) {
  
                  // Check that the new parent belongs to the same framework.
                  if ($this->newparent->get('competencyframeworkid') != $this->get('competencyframeworkid')) {
                      return new lang_string('invaliddata', 'error');
                  }
              }
          }
  
          return true;
      }
code: protected function validate_parentid($value) {
  
          // Check that the parent exists. But only if we don't have it already, and we actually have a parent.
          if (!empty($value) && !$this->newparent && !self::record_exists($value)) {
              return new lang_string('invaliddata', 'error');
          }
  
          // During update.
          if ($this->get('id')) {
  
              // If there is a new parent.
              if ($this->beforeupdate->get('parentid') != $value && $this->newparent) {
  
                  // Check that the new parent belongs to the same framework.
                  if ($this->newparent->get('competencyframeworkid') != $this->get('competencyframeworkid')) {
                      return new lang_string('invaliddata', 'error');
                  }
              }
          }
  
          return true;
      }
code_tokens: protected function validate_parentid ( $ value ) { // Check that the parent exists. But only if we don't have it already, and we actually have a parent. if ( ! empty ( $ value ) && ! $ this -> newparent && ! self :: record_exists ( $ value ) ) { return new lang_string ( 'invaliddata' , 'error' ) ; } // During update. if ( $ this -> get ( 'id' ) ) { // If there is a new parent. if ( $ this -> beforeupdate -> get ( 'parentid' ) != $ value && $ this -> newparent ) { // Check that the new parent belongs to the same framework. if ( $ this -> newparent -> get ( 'competencyframeworkid' ) != $ this -> get ( 'competencyframeworkid' ) ) { return new lang_string ( 'invaliddata' , 'error' ) ; } } } return true ; }
docstring: Validate the parent ID.
  
  @param string $value The ID.
  @return true|lang_string
docstring_tokens: Validate the parent ID .