You are here

function footnotes_is_footnotes_later in Footnotes 8.2

Same name and namespace in other branches
  1. 5.2 footnotes.module \footnotes_is_footnotes_later()
  2. 5 footnotes.module \footnotes_is_footnotes_later()
  3. 6.2 footnotes.module \footnotes_is_footnotes_later()
  4. 6 footnotes.module \footnotes_is_footnotes_later()
  5. 7.3 footnotes.module \footnotes_is_footnotes_later()
  6. 7.2 footnotes.module \footnotes_is_footnotes_later()

Helper for other filters, check if Footnotes is present in your filter chain.

Note: Due to changes in Filter API, the arguments to this function have changed in Drupal 7.

Other filters may leverage the Footnotes functionality in a simple way: by outputting markup with <fn>...</fn> tags within.

This creates a dependency, the Footnotes filter must be present later in "Input format". By calling this helper function the other filters that depend on Footnotes may check whether Footnotes is present later in the chain of filters in the current Input format.

If this function returns true, the caller may depend on Footnotes. Function returns false if caller may not depend on Footnotes.

You should also put "dependencies = footnotes" in your module.info file.

Example usage: <code> _filter_example_process( $text, $filter, $format ) { ... if(footnotes_is_footnotes_later($format, $filter)) { //output markup which may include [fn] tags } else { // must make do without footnotes features // can also emit warning/error that user should install and configure // footnotes module } ... } </code>

Parameters

object $format: The text format object caller is part of.

object $caller_filter: The filter object representing the caller (in this text format).

Return value

True If Footnotes is present after $caller in $format.

File

./footnotes.module, line 90
This file contains the hooks for Footnotes module.

Code

function footnotes_is_footnotes_later($format, $caller_filter) {
  return $format['filter_footnotes']['weight'] > $caller_filter['weight'];
}