Badge Factor 2 is a WordPress plugin which issues and manages Open Badges with Badgr Server.
Badge Factor 2 uses a custom templating engine which uses Controllers to define all the fields required to display the template, which are assigned to a global $bf2_template
variable.
If templates have not been overriden in the theme, Badge Factor 2 falls back to the templates provided in its plugin or add-ons. The template structure is as follows:
- Including header and footer:
templates/{plugin}/{template_file}
- Content template only:
templates/{plugin}/content/{template_file}
- Including header and footer:
{plugin}/templates/{template_file}
- Content template only:
{plugin}/templates/content/{template_file}
single-assertion.tpl.php
content/single-assertion.tpl.php
archive-badge-page.tpl.php
single-badge-page.tpl.php
content/archive-badge-page.tpl.php
content/single-badge-page.tpl.php
Some official Badge Factor 2 add-ons also provide templates in the same manner as the core plugin.
Uses the templating engine, but returns a generated PDF, and therefore does not provide a template.
archive-course.tpl.php
single-course.tpl.php
content/archive-course.tpl.php
content/single-course.tpl.php
Version 1.1.0 requires BuddyPress.
A new version of Badgefactor 2 is in the works to handle pathways.
The master-parcours and develop-parcours branches should be used to keep non-retroactively compatible changes out of master and develop.
Badgefactor 2 supports pathways by connecting to a Laravel-based utility that does the heavy lifting.
Pathways are integrated into Badgefactor 2 by introducing a minimal amount of new Wordpress functionality. New Wordpress templates sometimes contain specifically-identified divs to allow supplemental js to fill these parts asynchonously through AJAX to the laravel badges utility.
The following entries must be added to the Wordpress site's wp-config.php to enable patheways:
define( 'BF2_PATHWAYS_SUPPLEMENTAL_JS_URL','https://cadre21.ctrlweb.dev:2053/js/cadre21-supplemental.js' );
define( 'BF2_PATHWAYS_SUPPLEMENTAL_CSS_URL','https://cadre21.ctrlweb.dev:2053/css/main-cadre21.css' );