mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
Merge pull request #6587 from iMattPro/ticket/17291
[ticket/17291] Use icon function in ACP templates
This commit is contained in:
@@ -266,8 +266,8 @@ class helper
|
||||
'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'),
|
||||
'L_SKIP' => $this->language->lang('SKIP'),
|
||||
'PAGE_TITLE' => $this->language->lang($page_title),
|
||||
'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images',
|
||||
'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/javascript/jquery-3.6.0.min.js',
|
||||
'T_FONT_AWESOME_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/css/font-awesome.min.css',
|
||||
'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style',
|
||||
'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets',
|
||||
|
||||
|
@@ -432,10 +432,6 @@ class ajax_iohandler extends iohandler_base
|
||||
*/
|
||||
public function render_update_file_status($status_array)
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . 'adm/images/',
|
||||
));
|
||||
|
||||
foreach ($status_array as $block => $list)
|
||||
{
|
||||
foreach ($list as $filename)
|
||||
|
@@ -83,7 +83,7 @@ class icon extends AbstractExtension
|
||||
switch ($type)
|
||||
{
|
||||
case 'font':
|
||||
// Nothing to do here..
|
||||
$classes = $this->insert_fa_class($classes);
|
||||
break;
|
||||
|
||||
case 'png':
|
||||
@@ -168,6 +168,39 @@ class icon extends AbstractExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert fa class into class string by checking if class string contains any fa classes
|
||||
*
|
||||
* @param string $class_string
|
||||
* @return string Updated class string or original class string if fa class is already set or string is empty
|
||||
*/
|
||||
protected function insert_fa_class(string $class_string): string
|
||||
{
|
||||
if (empty($class_string))
|
||||
{
|
||||
return $class_string;
|
||||
}
|
||||
|
||||
// These also include pro class name we don't use, but handle them properly anyway
|
||||
$fa_classes = ['fa-solid', 'fas', 'fa-regular', 'far', 'fal', 'fa-light', 'fab', 'fa-brands'];
|
||||
|
||||
// Split the class string into individual words
|
||||
$icon_classes = explode(' ', $class_string);
|
||||
|
||||
// Check if the class string contains any of the fa classes, just return class string in that case
|
||||
foreach ($icon_classes as $word)
|
||||
{
|
||||
if (in_array($word, $fa_classes))
|
||||
{
|
||||
return $class_string;
|
||||
}
|
||||
}
|
||||
|
||||
// If we reach this it means we didn't have any fa classes in the class string.
|
||||
// Prepend class string with fas for fa-solid
|
||||
return 'fas ' . $class_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an SVG for usage in the template icon.
|
||||
*
|
||||
|
Reference in New Issue
Block a user