protected function addAjax(array $field)
    {
        // We add a class so this element can be recognised by js as having an
        // ajax action.
        $field['attributes'] = $this->addAttribute($field['attributes'], 'class', 'acumulus-ajax');

        // Add the data`-* attributes.
        if (!empty($field['ajax']) && is_array($field['ajax'])) {
            foreach ($field['ajax'] as $dataName => $dataValue) {
                $field['attributes'] = $this->addAttribute($field['attributes'], 'data-acumulus-' . $dataName, $dataValue);
            }
        }

        return $field;
    }