You are here

function custom_add_another_entity_bundle_field_info_alter in Custom add another 8

Implements hook_entity_bundle_field_info_alter().

File

./custom_add_another.module, line 17
Allows the 'Add another item' button text to be customised.

Code

function custom_add_another_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
  foreach ($fields as $field_type => &$field) {
    if ($field instanceof FieldConfigInterface && empty($field
      ->getThirdPartySettings('custom_add_another'))) {
      $field
        ->setThirdPartySetting('custom_add_another', 'custom_add_another', '')
        ->setThirdPartySetting('custom_add_another', 'custom_remove', '')
        ->save();
    }
  }
}