protected function is_unique($value) : bool {
        global $DB;
        $datafield = $this->datafield();
        $where = "fieldid = ? AND {$datafield} = ?";
        $params = [$this->get_field()->get('id'), $value];
        if ($this->get('id')) {
            $where .= ' AND id <> ?';
            $params[] = $this->get('id');
        }
        return !$DB->record_exists_select('customfield_data', $where, $params);
    }
protected function is_unique($value) : bool {
        global $DB;
        $datafield = $this->datafield();
        $where = "fieldid = ? AND {$datafield} = ?";
        $params = [$this->get_field()->get('id'), $value];
        if ($this->get('id')) {
            $where .= ' AND id <> ?';
            $params[] = $this->get('id');
        }
        return !$DB->record_exists_select('customfield_data', $where, $params);
    }
protected function is_unique ( $ value ) : bool { global $ DB ; $ datafield = $ this -> datafield ( ) ; $ where = "fieldid = ? AND {$datafield} = ?" ; $ params = [ $ this -> get_field ( ) -> get ( 'id' ) , $ value ] ; if ( $ this -> get ( 'id' ) ) { $ where .= ' AND id <> ?' ; $ params [ ] = $ this -> get ( 'id' ) ; } return ! $ DB -> record_exists_select ( 'customfield_data' , $ where , $ params ) ; }
Checks if the value is unique

@param mixed $value
@return bool
Checks if the value is unique