Custom validators may be overriden by default ones depending on load order
I'm using linkvalidator in a site which also uses the DAM. During the first tests it appeared that all links to the DAM were reported as broken page links.
This was due to the DAM extension being loaded before the linkvalidator. As such the custom link validator provided by the DAM came first when looping on the hook objects to determine the type. The DAM custom validator correctly detects the link of type "dam", but this is then overridden to "db" by the internal link validator.
What happens in detail: when a link to a DAM element comes for validation, it is first considered to be of type "db". In the internal linkvalidator, the type of the element being analyzed is matched against the key of the current validator, which is also "db" in this case. When the DAM extension comes after linkvalidator, this is fine, because DAM stuff is properly detected and link type is set to "dam". However when the DAM extension comes before linkvalidator, its correct detection is lost because the internal type comes afterwards and matches the "db" type.
My proposed solution is temporarily store the type in the current "record" information, so that the "db" type cannot be matched anymore when a more specific type was matched beforehand. With this change, the extension load order is not relevant anymore.
I'm attaching my patch here. I would quite like to have some feedback before pushing it to Gerrit.