-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5d40c6
commit b5dcc4d
Showing
7 changed files
with
249 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
################# | ||
file_markup_files | ||
################# | ||
|
||
.. versionadded:: 2.7 | ||
|
||
***** | ||
Usage | ||
***** | ||
|
||
Filter the set of files to be displayed by :php:func:`file_markup` | ||
|
||
Omeka uses functions like :php:func:`files_for_item` to render all | ||
the files attached to an item; this filter allows a developer | ||
to alter that list, for example to exclude some files from being | ||
displayed. | ||
|
||
***** | ||
Value | ||
***** | ||
|
||
``array`` $files | ||
Array of :php:class:`File` objects to be displayed | ||
|
||
********* | ||
Arguments | ||
********* | ||
|
||
``array`` options | ||
Options passed to ``file_markup`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
################### | ||
file_markup_options | ||
################### | ||
|
||
.. versionadded:: 2.7 | ||
|
||
***** | ||
Usage | ||
***** | ||
|
||
Modify the options passed to :php:func:`file_markup` | ||
|
||
Unlike the :doc:`file_markup` filter, this filter allows you to change | ||
options that Omeka uses when rendering HTML for a file, meaning you can | ||
alter the output without having to write completely new markup yourself. | ||
|
||
***** | ||
Value | ||
***** | ||
|
||
``array`` $options | ||
Array of options for ``file_markup`` | ||
|
||
********* | ||
Arguments | ||
********* | ||
|
||
:php:class:`File` file | ||
The file object | ||
|
||
******** | ||
Examples | ||
******** | ||
|
||
Add ``target="_blank"`` to all links to original files: | ||
|
||
.. code-block:: php | ||
class MyPlugin extends :php:class:`Omeka_Plugin_AbstractPlugin` | ||
{ | ||
protected $_filters = array('file_markup_options'); | ||
public filterHtmlPurifierConfigSetup($options, $args) | ||
{ | ||
$options['linkAttributes']['target'] = '_blank'; | ||
return $options; | ||
} | ||
} | ||
******** | ||
See Also | ||
******** | ||
|
||
:php:func:`file_markup` documentation for a list of possible options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
############## | ||
files_for_item | ||
############## | ||
|
||
.. versionadded:: 2.7 | ||
|
||
***** | ||
Usage | ||
***** | ||
|
||
Filter the HTML for displaying all files for an item. | ||
|
||
The :doc:`file_markup` filter is used to modify the HTML markup for | ||
displaying a single file, but this filter can be used to modify the | ||
markup for all the files being displayed as a whole (for example, to | ||
add markup that comes before or after, or wraps around, all the | ||
displayed files). | ||
|
||
***** | ||
Value | ||
***** | ||
|
||
``string`` $html | ||
The HTML for displaying the files | ||
|
||
********* | ||
Arguments | ||
********* | ||
|
||
:php:class:`Item` item | ||
The item object | ||
|
||
``array`` options | ||
Options to pass to the callback | ||
|
||
``string`` wrapperAttributes | ||
Attributes to apply to the wrapping ``<div>`` element | ||
|
||
******** | ||
See Also | ||
******** | ||
|
||
:php:func:`files_for_item` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
########################## | ||
html_purifier_config_setup | ||
########################## | ||
|
||
.. versionadded:: 2.7 | ||
|
||
***** | ||
Usage | ||
***** | ||
|
||
Alters the configuration settings for the HTMLPurifier library. | ||
|
||
***** | ||
Value | ||
***** | ||
|
||
``HTMLPurifier_Config`` $purifierConfig | ||
The config object for HTMLPurifier | ||
|
||
********* | ||
Arguments | ||
********* | ||
|
||
``array`` defaults | ||
The default configuration keys (these have already been set to the passed config object) | ||
``array`` allowedHtmlElements | ||
List of user-configured enabled elements | ||
``array`` allowedHtmlAttributes | ||
List of user-configured enabled attributes | ||
|
||
******** | ||
Examples | ||
******** | ||
|
||
Force a prefix on all user-provided ``id`` attributes (for other options see the HTMLPurifier | ||
documentation pages linked below: | ||
|
||
.. code-block:: php | ||
class MyPlugin extends :php:class:`Omeka_Plugin_AbstractPlugin` | ||
{ | ||
protected $_filters = array('html_purifier_config_setup'); | ||
public filterHtmlPurifierConfigSetup($purifierConfig, $args) | ||
{ | ||
$purifierConfig->set('Attr.IDPrefix', 'foo_'); | ||
return $purifierConfig; | ||
} | ||
} | ||
******** | ||
See Also | ||
******** | ||
|
||
- `HTMLPurifier customization documentation <http://htmlpurifier.org/docs/enduser-customize.html>`_ | ||
|
||
- `HTMLPurifier list of configuration options <http://htmlpurifier.org/live/configdoc/plain.html>`_ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#################### | ||
image_tag_attributes | ||
#################### | ||
|
||
.. versionadded:: 2.7 | ||
|
||
***** | ||
Usage | ||
***** | ||
|
||
Filter the HTML attributes used for an record's image. | ||
|
||
This filter affects ``<img>`` tags created by :php:func:`file_markup`, :php:func:`files_for_item`, | ||
:php:func:`record_image`, :php:func:`item_image`, and :php:func:`file_image` (essentially meaning | ||
it covers anywhere derivative images are used for a record). | ||
|
||
***** | ||
Value | ||
***** | ||
|
||
``array`` $attrs | ||
Array of HTML attributes for the ``<img>`` tag. | ||
|
||
********* | ||
Arguments | ||
********* | ||
|
||
:php:class:`Omeka_Record` record | ||
The record being displayed (could be an Item or Collection in the case of a thumbnail) | ||
|
||
:php:class:`File` file | ||
The file being displayed. This is always the File that directly corresponds with the | ||
image, while ``record`` can be another record like an Item, Collection or Exhibit | ||
that simply uses the File as its representative image. | ||
|
||
``string`` format | ||
Type of derivative image being displayed (e.g., ``'thumbnail'``, ``'fullsize'``, ``'square_thumbnail'``) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters