You are here

function paragraphs_test_paragraphs_widget_actions_alter in Paragraphs 8

Implements hook_paragraphs_widget_actions_alter().

File

tests/modules/paragraphs_test/paragraphs_test.module, line 15
Test module for testing the paragraphs module.

Code

function paragraphs_test_paragraphs_widget_actions_alter(&$widget_actions, &$context) {
  if (!$context['allow_reference_changes']) {
    return;
  }
  if (\Drupal::state()
    ->get('paragraphs_test_dropbutton')) {
    $widget_actions['dropdown_actions']['test_button'] = ParagraphsWidget::expandButton([
      '#type' => 'submit',
      '#value' => t('Add to library'),
      '#delta' => 0,
      '#name' => 'field_paragraphs_test',
      '#weight' => 504,
      '#paragraphs_mode' => 'remove',
    ]);
  }
}