-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #35: Add support for FontAwesome 5.
- Loading branch information
Jen Lampton
committed
Aug 28, 2021
1 parent
9a60285
commit 06f96fa
Showing
3 changed files
with
41 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,9 +198,13 @@ function on_the_web_display_block($delta, $settings = array(), $contexts = array | |
if (isset($info['fa-icon'])) { | ||
$icon = $info['fa-icon']; | ||
} | ||
// Only use a square version if it exists. | ||
// Only use a square icon if it exists. | ||
if ($config->get('square') == TRUE && isset($info['fa-icon-square'])) { | ||
$icon = $info['fa-icon-square']; | ||
|
||
if ($config->get('version') == '5.x.x' && $service == 'linkedin') { | ||
$icon = $info['fa-icon']; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -215,29 +219,36 @@ function on_the_web_display_block($delta, $settings = array(), $contexts = array | |
'#weight' => $config->get($service . '_weight'), | ||
); | ||
} | ||
} | ||
|
||
if ($type == 'anchor') { | ||
$links['#attached']['css'][] = backdrop_get_path('module', 'on_the_web') . '/css/on_the_web.css'; | ||
} | ||
elseif ($type == 'font') { | ||
if (!module_exists('font_awesome')) { | ||
|
||
$version = $config->get('version'); | ||
switch ($version) { | ||
case '4.7.0': | ||
$font_url = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'; | ||
break; | ||
case '1.2.0': | ||
$font_url = 'https://cdn.jsdelivr.net/npm/[email protected]/css/fork-awesome.min.css'; | ||
break; | ||
/* @todo Support FA5 | ||
case '5.x.x': | ||
$hash = $config->get('kit_hash'); | ||
$font_url = 'https://kit.fontawesome.com/' . $hash . '.js'; | ||
break; | ||
*/ | ||
} | ||
// Add the assets. | ||
if ($type == 'anchor') { | ||
$links['#attached']['css'][] = backdrop_get_path('module', 'on_the_web') . '/css/on_the_web.css'; | ||
} | ||
elseif ($type == 'font') { | ||
if (!module_exists('font_awesome')) { | ||
|
||
$version = $config->get('version'); | ||
switch ($version) { | ||
case '4.7.0': | ||
$font_url = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'; | ||
break; | ||
case '1.2.0': | ||
$font_url = 'https://cdn.jsdelivr.net/npm/[email protected]/css/fork-awesome.min.css'; | ||
break; | ||
case '5.x.x': | ||
//$font_url = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css'; | ||
// Add V4 shims? | ||
//$links['#attached']['css']['https://use.fontawesome.com/releases/v5.15.4/css/v4-shims.css'] = array('type' => 'external'); | ||
$hash = $config->get('kit_hash'); | ||
if (!empty($hash)) { | ||
$font_js_url = 'https://kit.fontawesome.com/' . $hash . '.js'; | ||
$links['#attached']['js'][$font_js_url] = array('type' => 'external'); | ||
} | ||
break; | ||
} | ||
|
||
if (isset($font_url)) { | ||
$links['#attached']['css'][$font_url] = array('type' => 'external'); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters