Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Omeka-S-module-OaiPmhRepository
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CORDEL Yannick
Omeka-S-module-OaiPmhRepository
Commits
3712cd61
Commit
3712cd61
authored
6 years ago
by
Daniel Berthereau
Browse files
Options
Downloads
Patches
Plain Diff
Added an event to filter values during creation of xml.
parent
8d0ecdc7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OaiPmh/Metadata/AbstractMetadata.php
+37
-1
37 additions, 1 deletion
src/OaiPmh/Metadata/AbstractMetadata.php
with
37 additions
and
1 deletion
src/OaiPmh/Metadata/AbstractMetadata.php
+
37
−
1
View file @
3712cd61
...
...
@@ -14,7 +14,11 @@ use OaiPmhRepository\OaiPmh\OaiSet\OaiSetInterface;
use
OaiPmhRepository\OaiPmh\Plugin\OaiIdentifier
;
use
Omeka\Api\Representation\AbstractResourceEntityRepresentation
;
use
Omeka\Api\Representation\ItemRepresentation
;
use
Omeka\Api\Representation\ValueRepresentation
;
use
Omeka\Settings\SettingsInterface
;
use
Zend\EventManager\Event
;
use
Zend\EventManager\EventManagerAwareInterface
;
use
Zend\EventManager\EventManagerAwareTrait
;
/**
* Abstract class on which all other metadata format handlers are based.
...
...
@@ -23,8 +27,12 @@ use Omeka\Settings\SettingsInterface;
* @todo Migration to PHP 5.3 will allow the abstract getter functions to be
* static, as they should be
*/
abstract
class
AbstractMetadata
extends
AbstractXmlGenerator
implements
MetadataInterface
abstract
class
AbstractMetadata
extends
AbstractXmlGenerator
implements
MetadataInterface
,
EventManagerAwareInterface
{
use
EventManagerAwareTrait
;
/**
* @var SettingsInterface
*/
...
...
@@ -138,6 +146,34 @@ abstract class AbstractMetadata extends AbstractXmlGenerator implements Metadata
}
}
/**
* Filter values (remove, update or append) of a resource via an event.
*
* @param AbstractResourceEntityRepresentation $resource
* @param string $term
* @param ValueRepresentation|ValueRepresentation[]|null $values
* @return ValueRepresentation|ValueRepresentation[]|null
*/
protected
function
filterValues
(
AbstractResourceEntityRepresentation
$resource
,
$term
,
$values
)
{
/** @var \Zend\EventManager\EventManager $eventManager */
$eventManager
=
$this
->
getEventManager
();
/** @var \ArrayObject $args */
$args
=
$eventManager
->
prepareArgs
([]);
$args
[
'repository'
]
=
self
::
class
;
$args
[
'resource'
]
=
$resource
;
$args
[
'term'
]
=
$term
;
$args
[
'values'
]
=
$values
;
$event
=
new
Event
(
'oaipmhrepository.values'
,
$this
,
$args
);
$eventManager
->
triggerEvent
(
$event
);
return
$args
[
'values'
];
}
/**
* Appends a metadata element, a child element with the required format, and
* further children for each of the properties present in the item.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment