You are here

function bynder_sns_form_bynder_configuration_form_alter in Bynder 4.0.x

Implements hook_form_FORM_ID_alter().

File

modules/bynder_sns/bynder_sns.module, line 14
Module hooks for the Bynder SNS module.

Code

function bynder_sns_form_bynder_configuration_form_alter(&$form, FormStateInterface $form_state) {
  $form['bynder_sns'] = [
    '#type' => 'details',
    '#title' => t('Amazon SNS notifications'),
    '#description' => t('Integration with the Amazon SNS module allows to process changes to assets in Bynder immediately. To set this up, a subscription must be configured for this Drupal installation, pointing to @subscription_url. Once set up the topic name should be logged as part of the successful confirmation. See the <a href=":documentation_url">documentation</a> for more information. Once configured, the background metadata refresh can be disabled.', [
      '@subscription_url' => Url::fromRoute('amazon_sns.notify')
        ->setAbsolute()
        ->toString(),
      '@documntation_url' => 'https://help.bynder.com/system/SNS_notifications.htm',
    ]),
    '#open' => TRUE,
  ];
  $config = \Drupal::configFactory()
    ->getEditable('bynder_sns.settings');
  $form['bynder_sns']['topic'] = [
    '#type' => 'textfield',
    '#title' => t('Topic'),
    '#description' => t('Configure the SNS topic name, only notifications from this topic will be processed.'),
    '#placeholder' => 'arn:aws:sns:eu-central-1:......',
    '#default_value' => $config
      ->get('topic'),
    '#size' => '100',
  ];
  $form['#submit'][] = 'bynder_sns_settings_submit';
}