protected function validate_path($value) {

        // The last item should be the parent ID.
        $id = $this->get('parentid');
        if (substr($value, -(strlen($id) + 2)) != '/' . $id . '/') {
            return new lang_string('invaliddata', 'error');

        } else if (!preg_match('@/([0-9]+/)+@', $value)) {
            // The format of the path is not correct.
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
protected function validate_path($value) {

        // The last item should be the parent ID.
        $id = $this->get('parentid');
        if (substr($value, -(strlen($id) + 2)) != '/' . $id . '/') {
            return new lang_string('invaliddata', 'error');

        } else if (!preg_match('@/([0-9]+/)+@', $value)) {
            // The format of the path is not correct.
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
protected function validate_path ( $ value ) { // The last item should be the parent ID. $ id = $ this -> get ( 'parentid' ) ; if ( substr ( $ value , - ( strlen ( $ id ) + 2 ) ) != '/' . $ id . '/' ) { return new lang_string ( 'invaliddata' , 'error' ) ; } else if ( ! preg_match ( '@/([0-9]+/)+@' , $ value ) ) { // The format of the path is not correct. return new lang_string ( 'invaliddata' , 'error' ) ; } return true ; }
Validate the path.

@param string $value The path.
@return true|lang_string
Validate the path .