Remove deprecated farm_log_asset_names_summary() function.
This commit is contained in:
parent
8ff9000b4c
commit
abe4aff642
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- [Issue #3382616: Remove v1 migrations from farmOS 3.x](https://www.drupal.org/project/farm/issues/3382616)
|
- [Issue #3382616: Remove v1 migrations from farmOS 3.x](https://www.drupal.org/project/farm/issues/3382616)
|
||||||
- [QuickFormInterface::getId() is replaced by QuickFormInterface::getQuickId()](https://www.drupal.org/node/3379686)
|
- [QuickFormInterface::getId() is replaced by QuickFormInterface::getQuickId()](https://www.drupal.org/node/3379686)
|
||||||
|
- [Remove deprecated farm_log_asset_names_summary()](https://www.drupal.org/node/3359456)
|
||||||
|
|
||||||
## [2.2.2] 2023-10-25
|
## [2.2.2] 2023-10-25
|
||||||
|
|
||||||
|
|
|
@ -52,41 +52,3 @@ function farm_log_entity_prepare_form(EntityInterface $entity, $operation, FormS
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a summary of asset names for use in a log name.
|
|
||||||
*
|
|
||||||
* Note that this function does NOT sanitize the asset names. This is the
|
|
||||||
* responsibility of downstream code, if it is printing the text to the page.
|
|
||||||
*
|
|
||||||
* @param \Drupal\asset\Entity\AssetInterface[] $assets
|
|
||||||
* An array of assets.
|
|
||||||
* @param int $cutoff
|
|
||||||
* The number of asset names to include before summarizing the rest.
|
|
||||||
* If the number of assets exceeds the cutoff, the rest will be summarized
|
|
||||||
* as "(+X more)". If the number of assets is less than or equal to the
|
|
||||||
* cutoff, or if the cutoff is 0, all asset names will be included.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* Returns a string summarizing the assets.
|
|
||||||
*
|
|
||||||
* @deprecated in farm:2.2.0 and is removed from farm:3.0.0. Use
|
|
||||||
* QuickStringTrait::entityLabelsSummary() instead.
|
|
||||||
* @see https://www.drupal.org/node/3359456
|
|
||||||
*/
|
|
||||||
function farm_log_asset_names_summary(array $assets, $cutoff = 3) {
|
|
||||||
/** @var \Drupal\asset\Entity\AssetInterface[] $assets */
|
|
||||||
$names = [];
|
|
||||||
foreach ($assets as $asset) {
|
|
||||||
$names[] = $asset->label();
|
|
||||||
}
|
|
||||||
if ($cutoff != 0) {
|
|
||||||
array_splice($names, $cutoff);
|
|
||||||
}
|
|
||||||
$output = implode(', ', $names);
|
|
||||||
$diff = count($assets) - count($names);
|
|
||||||
if ($diff > 0) {
|
|
||||||
$output .= ' (+' . $diff . ' ' . t('more') . ')';
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue