/
FaButton.subs.php
62 lines (53 loc) · 1.45 KB
/
FaButton.subs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* @package Elk FontAwesome Button
* @author Spuds
* @copyright (c) 2015 Spuds
* @license Mozilla Public License version 1.1 http://www.mozilla.org/MPL/1.1/
*
* @version 1.0.2
*
*/
/**
* ibb_fa_button
*
* - Editor hook, integrate_bbc_buttons hook, Called from Editor.subs.php
* - Used to add buttons to the editor menu bar
*
* @param mixed[] $bbc_tags
*/
function ibb_fa_button(&$bbc_tags)
{
// This is the group we intend to modify
$where = $bbc_tags['row1'][2];
// And here we insert the new value after font
$bbc_tags['row1'][2] = elk_array_insert($where, 'font', array('fontawesome'), 'after', false);
// Add the javascript, this tells the editor what to do with the new button
loadJavascriptFile('FaButton.plugin.js', array(), 'faButton');
// CSS specific to this button presentation in the editor toolbar
loadCSSFile('FaButton.css', array(), 'fa44');
}
/**
* integrate_editor_plugins
*
* - Editor hook, integrate_editor_plugins hook, Called from Editor.subs.php
* - Used to add plugins to the editor
*
* @param string $editor_id
*/
function iep_fa_button($editor_id)
{
global $context;
$context['controls']['richedit'][$editor_id]['plugin_addons'][] = 'fontawesome';
}
/**
* integrate_init_theme
*
* Called from Load.php, used here to turn on FA support in ElkArte 1.1
*/
function iit_fa_button()
{
global $modSettings;
if (empty($modSettings['require_font-awesome']))
$modSettings['require_font-awesome'] = true;
}