VersionPress\ChangeInfos\BulkChangeInfo::getChangeDescription PHP Méthode

getChangeDescription() public méthode

    public function getChangeDescription()
    {
        $entityName = $this->getScope();
        $action = $this->getAction();
        if ($this->count === 1) {
            $defaultDescription = $this->changeInfos[0]->getChangeDescription();
        } else {
            $defaultDescription = sprintf("%s %d %s", Strings::capitalize(StringUtils::verbToPastTense($action)), $this->count, StringUtils::pluralize($entityName));
        }
        $tags = array_map(function (TrackedChangeInfo $changeInfo) {
            return $changeInfo->getCustomTags();
        }, $this->changeInfos);
        return apply_filters("vp_bulk_change_description_{$entityName}", $defaultDescription, $action, $this->count, $tags);
    }

Usage Example

 public function getChangeDescription()
 {
     if ($this->count === 1) {
         return $this->changeInfos[0]->getChangeDescription();
     }
     $taxonomies = StringUtils::pluralize($this->getTaxonomyName());
     if ($this->getAction() === "delete") {
         return "Deleted {$this->count} {$taxonomies}";
     }
     return parent::getChangeDescription();
 }
All Usage Examples Of VersionPress\ChangeInfos\BulkChangeInfo::getChangeDescription