Follow

Pugpig Helper Functions

Pugpig has many helper functions that can help you improve your app.

pugpig_value

Returns the value of a field for a given node.

$string = pugpig_value($node, $field)

pugpig_print_toc

Prints out a nested list for the table of contents.

$html = pugpig_print_toc($sections)

pugpig_get_nested_section_array

Returns an array of pages, grouped by section.

$array = pugpig_get_nested_section_array($edition)

pugpig_page_url

Returns the relative path to the Pugpig index.html page.

$path = pugpig_page_url($node_id)

pugpig_theme_item_url

Returns an index relative URL to a theme item. If $file_path is an empty string, returns a relative URL to the themes directory.

$url = pugpig_theme_item_url($file_path)

pugpig_module_item_url

Returns a relative URL to a static file contained in a module.

$url = pugpig_module_item_url($module, $file_path, $edition_id)

pugpig_get_index_relative_page_url

Return a path to a node relative to a normal (index.html) page. Can be used from inline linking.

$url = pugpig_get_index_relative_page_url($node_id)

pugpig_get_index_relative_image_path

Returns a relative path to the image, given a node and an image field, that can be used from a normal (index.html) page. Can be used from inline images.

$path = pugpig_get_index_relative_image_path($image_node, $image_field)

pugpig_extract_assets_from_html

Returns an array of Pugpig URLs extracted from a block of text. Only tested on IMCE generated fields at the moment

$array = pugpig_extract_assets_from_html($markup, $node_id)

pugpig_rewrite_html

Returns a block of markup with image URLs fixed.

$html = pugpig_rewrite_html($markup, $node_id)

pugpig_get_manifest_attachments_for_field

Looks for any child items in a specific node reference and includes their attachments as manifests.

$string = pugpig_get_manifest_attachments_for_field($node, $field)

pugpig_get_multivalue_array

Gets an array of values from a multi-valued field.

$array = pugpig_get_multivalue_array($node, $key)

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk