Compare commits

..

No commits in common. '1c009bdca7b10ddbc68a1624b64520cd77275fa5' and '40f16ef6718893931f22da3ef4f5475198d0dce4' have entirely different histories.

  1. 2
      README.md
  2. 2
      node_media_action_bridge.links.menu.yml
  3. 53
      src/Form/BridgeForm.php

2
README.md

@ -20,7 +20,7 @@ It then checks the underlying media Action's access for each media entity and ex
3. Go to:
`/admin/config/content/node-media-actions`
`/admin/config/islandora/node-media-actions`
4. Click **Add node media action**.
5. Enter the label you want exposed at node level and choose an existing configured media Action.

2
node_media_action_bridge.links.menu.yml

@ -2,4 +2,4 @@ node_media_action_bridge.list:
title: 'Node media actions'
description: 'Create node Actions that run configured media Actions on related media.'
route_name: node_media_action_bridge.list
parent: system.admin_config_islandora
parent: system.admin_config_islandora

53
src/Form/BridgeForm.php

@ -7,8 +7,6 @@ use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Action\ActionManager;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenModalDialogCommand;
/**
* Add/edit form for node media Action wrappers.
@ -61,20 +59,6 @@ class BridgeForm extends FormBase {
}
natcasesort($options);
$form['#attached']['library'][] = 'core/drupal.dialog.ajax';
$form['usage_help'] = [
'#type' => 'button',
'#value' => $this->t('How to use this form'),
'#ajax' => [
'callback' => '::usageHelpModal',
],
'#attributes' => [
'class' => ['button', 'button--small'],
],
'#limit_validation_errors' => [],
];
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Node Action label'),
@ -119,43 +103,6 @@ class BridgeForm extends FormBase {
return $form;
}
/**
* Opens the usage instructions in a modal dialog.
*/
public function usageHelpModal(array &$form, FormStateInterface $form_state): AjaxResponse {
$content = [
'#type' => 'container',
'intro' => [
'#markup' => '<p>' . $this->t('This form creates a node-level Action that runs an existing configured media Action against every media item whose <code>field_media_of</code> references the selected node.') . '</p>',
],
'steps' => [
'#theme' => 'item_list',
'#list_type' => 'ol',
'#items' => [
$this->t('Enter the label you want users to see when selecting the node Action.'),
$this->t('Accept the generated machine name, or change it before the Action is first saved.'),
$this->t('Choose the configured media Action that should be executed for the node’s associated media.'),
$this->t('Click Save. The module creates a configured node Action automatically.'),
$this->t('Use that node Action from Views Bulk Operations, the Collection Manager, or any other interface that exposes configured node Actions.'),
],
],
'notes' => [
'#markup' => '<p><strong>' . $this->t('What happens when it runs:') . '</strong> ' . $this->t('The wrapper finds all media referencing the node through field_media_of, checks access for the selected media Action, and executes that Action against the eligible media items.') . '</p>',
],
'tip' => [
'#markup' => '<p><strong>' . $this->t('Tip:') . '</strong> ' . $this->t('If the media Action you need is not listed, configure/create that media Action first, then return to this form.') . '</p>',
],
];
$response = new AjaxResponse();
$response->addCommand(new OpenModalDialogCommand(
$this->t('How to use this form'),
$content,
['width' => 700],
));
return $response;
}
/**
* Machine-name existence callback.
*/

Loading…
Cancel
Save