diff --git a/README.md b/README.md index 3580be8..eeaa2a4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,34 @@ # Islandora Entity Status + +![](https://github.com/discoverygarden/islandora_entity_status/actions/workflows/lint.yml/badge.svg) +![](https://github.com/discoverygarden/islandora_entity_status/actions/workflows/semver.yml/badge.svg) +[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) + ## Introduction Cascades entity status to all referenced entities in an Islandora repository item +## Table of Contents + +* [Features](#features) +* [Requirements](#requirements) +* [Installation](#installation) +* [Usage](#usage) +* [Troubleshooting/Issues](#troubleshootingissues) +* [Maintainers and Sponsors](#maintainers-and-sponsors) +* [Development/Contribution](#developmentcontribution) +* [License](#license) + +## Features + +Includes the command `islandora_entity_status:find-update-related-nodes` (aliased as `furnd`). This command will update a node's status and its related children's statuses in bulk. + +It has two parameters: + - `nodes`: A comma-separated list of node IDs to be be processed. + - `status`: The status to be assigned to the nodes (0 or 1). + +The module will maintain these status updates to their children through `node_update` and `media_presave` hooks. As well, the user will be alerted that their updates will cascade to their children when updating a node's status. + ## Requirements This module requires the following modules/libraries: @@ -15,6 +41,12 @@ Install as usual, see [this]( https://www.drupal.org/docs/extending-drupal/installing-modules) for further information. +## Usage + +```bash +drush islandora_entity_status:furnd --nodes="1,2,3" --status=1 +``` + ## Troubleshooting/Issues Having problems or solved a problem? Contact [discoverygarden](http://support.discoverygarden.ca). @@ -23,9 +55,10 @@ Having problems or solved a problem? Contact [discoverygarden](http://support.di This project has been sponsored by: +* Boston College * [discoverygarden](http://wwww.discoverygarden.ca) -## Development +## Development/Contribution If you would like to contribute to this module, please check out our helpful [Documentation for Developers](https://github.com/Islandora/islandora/wiki#wiki-documentation-for-developers) diff --git a/islandora_entity_status.module b/islandora_entity_status.module index f885804..404ae60 100644 --- a/islandora_entity_status.module +++ b/islandora_entity_status.module @@ -53,7 +53,7 @@ function islandora_entity_status_node_update(EntityInterface $entity) { } // Trigger the batch process for collection node. - $node_ids_to_update = find_collection_nodes($nid); + $node_ids_to_update = islandora_entity_status_find_collection_nodes($nid); $latestStatus = $entity->get('status')->value; islandora_entity_status_trigger_batch_process($node_ids_to_update, $latestStatus); @@ -78,7 +78,7 @@ function islandora_entity_status_form_node_islandora_object_edit_form_alter(&$fo /** * Find related nodes. */ -function find_collection_nodes($currentNodeId) { +function islandora_entity_status_find_collection_nodes($currentNodeId) { $relatedNodeIds = []; // Initial query to find nodes where the field_member_of contains diff --git a/src/Commands/BulkStatusCommands.php b/src/Commands/BulkStatusCommands.php index 10aaa9e..4a814b5 100644 --- a/src/Commands/BulkStatusCommands.php +++ b/src/Commands/BulkStatusCommands.php @@ -3,9 +3,9 @@ namespace Drupal\islandora_entity_status\Commands; use Drupal\Core\DependencyInjection\DependencySerializationTrait; -use Drush\Commands\DrushCommands; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drush\Commands\DrushCommands; /** * Drush command implementation.