Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #153 from JMAConsulting/wordpress_shortcode
Browse files Browse the repository at this point in the history
Remove wordpress shortcode override and replace with hook
  • Loading branch information
Edzelopez authored Jul 20, 2020
2 parents f4f17a8 + 99005da commit 887fb6e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 877 deletions.
24 changes: 24 additions & 0 deletions grantapplications.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,3 +615,27 @@ function grantapplications_dashboardActionLinks() {
),
);
}

if (function_exists('add_filter')) {
add_filter('civicrm_shortcode_preprocess_atts', 'grantapplications_amend_args', 10, 2);
add_filter('civicrm_shortcode_get_data', 'grantapplications_amend_data', 10, 3);
}

function grantapplications_amend_args($args, $shortcode_attrs) {
extract($shortcode_attrs);
if ($component === 'grant') {
$args['q'] = 'civicrm/grant/transact';
}
return $args;
}

function grantapplications_amend_data(&$data, $atts, $args) {
if ($atts['component'] === 'grant') {
$dao = CRM_Core_DAO::executeQuery("SELECT title, intro_text FROM civicrm_grant_app_page WHERE id = %1", [1 => [$args['id'], 'Positive']]);
while ($dao->fetch()) {
$data['title'] = $dao->title;
$data['text'] = $dao->intro_text;
}
}
return $data;
}

This file was deleted.

Loading

0 comments on commit 887fb6e

Please sign in to comment.