fix: Shortcuts now follow their linked asset when trashing, purging, and restoring from trash
This commit is contained in:
parent
e41f544f4f
commit
f684e728c8
4 changed files with 162 additions and 18 deletions
|
|
@ -11,6 +11,7 @@ package WebGUI::Asset::Shortcut;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Carp;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::International;
|
||||
|
|
@ -906,5 +907,43 @@ sub www_view {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head1 STATIC METHODS
|
||||
|
||||
These methods are called using CLASS->method
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getShortcutsForAssetId ( session, assetId [, properties] )
|
||||
|
||||
Get an arrayref of assetIds of all the shortcuts for the passed-in assetId.
|
||||
|
||||
"properties" is a hash reference of properties to give to getLineage.
|
||||
Probably the only useful key will be "returnObjects".
|
||||
|
||||
=cut
|
||||
|
||||
sub getShortcutsForAssetId {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $assetId = shift;
|
||||
my $properties = shift || {};
|
||||
|
||||
croak "First argument to getShortcutsForAssetId must be WebGUI::Session"
|
||||
unless $session && $session->isa("WebGUI::Session");
|
||||
croak "Second argument to getShortcutsForAssetId must be assetId"
|
||||
unless $assetId;
|
||||
croak "Third argument to getShortcutsForAssetId must be hash reference"
|
||||
if $properties && !ref $properties eq "HASH";
|
||||
|
||||
my $db = $session->db;
|
||||
|
||||
$properties->{ joinClass } = 'WebGUI::Asset::Shortcut';
|
||||
$properties->{ whereClause } = 'Shortcut.shortcutToAssetId = ' . $db->quote($assetId);
|
||||
|
||||
return WebGUI::Asset->getRoot($session)->getLineage(['descendants'], $properties);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue