Customise errors when validating model data? I’m trying to set a custom message for a specific model attribute. I have something like this:

protected function defineAttributes() {
    return array(
        'attributeOne' =&gt; array(
            AttributeType::String,
            'required' =&gt; true,
            'label' =&gt; 'Attribute One Label'
        ),
        'attributeTwo' =&gt; array(
            AttributeType::String,
            'required' =&gt; true,
            'label' =&gt; 'Attribute Two Label'
        )
    );
}


How can I customise a specific error message for each attribute so that instead of ‘Attribute One Label cannot be blank’, I get ‘Attribute One Label with my custom message’?
In addition to Brad&#8217;s answer (which is what I was looking for), you could also use template-specific messages using conditionals if for some reason you only needed to override the global error in a certain place. Unlikely but here’s an example:

{% if errors.attributeOne is defined ? errors.attributeOne | length %}
    &lt;p class="alert"&gt;Custom message.&lt;/p&gt;
{% endif %}