CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • WP shortcode hook?
Pages: [1]

Author Topic: WP shortcode hook?  (Read 475 times)

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
WP shortcode hook?
April 08, 2015, 10:05:35 am
We would like to not have to override civicrm.modal.js and civicrm.modal.php to add a Grant Applications shortcode. I recall seeing others wanting to add shortcode support for new things in civicrm.

1. Looking at https://github.com/JMAConsulting/biz.jmaconsulting.grantapplications/commit/dd10b72c1ddb390a2e8858699032f20fcfe3613f I think it would likely be possible to create a single hook for the civicrm.modal.php file that would provide return values that could add code for lines 58-60 and 84-92. One approach might be to efactor to hold a few values in a table, and loop through it to generate add_civicomponent_id option values and associated span. 

2. I'm not at all clear on the best architecture for creating a hook for civicrm.modal.js that will run in the client browser, like for lines 49-52 and 83-90. I don't like a callback to the server (or especially two!), which makes me think it would be best to call the hook on the server and use its results to generate the js that will go to the browser. But this seems like a more general issue that will recur more and more as we migrate away from PHP 4.x approaches to AngularJS. So I'm thinking this might be best handled by the core team.

So, could you advise on what we should be doing here and whether core team might take on developing a hook pattern for AngularJS files?

Thanks,
Joe
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: WP shortcode hook?
April 08, 2015, 11:49:45 am
I agree the code for WP shortcodes needs refactoring and would be happy to discuss with you further.
Try asking your question on the new CiviCRM help site.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: WP shortcode hook?
June 10, 2015, 10:44:12 am
See https://issues.civicrm.org/jira/browse/CRM-16650
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • WP shortcode hook?

This forum was archived on 2017-11-26.