73 lines
2.5 KiB
PHP
73 lines
2.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
use yii\db\Migration;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Class m260227_034241_update_cms_menu_frontend_icons
|
||
|
|
*/
|
||
|
|
class m260227_034241_update_cms_menu_frontend_icons extends Migration
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* {@inheritdoc}
|
||
|
|
*/
|
||
|
|
public function safeUp()
|
||
|
|
{
|
||
|
|
// 1. Ensure all icons start with "fa fa-"
|
||
|
|
$this->execute("UPDATE cms_menu_frontend SET icon = CONCAT('fa ', icon) WHERE icon NOT LIKE 'fa %' AND icon IS NOT NULL AND icon != ''");
|
||
|
|
|
||
|
|
// 2. Map Font Awesome 5+ icons to 4.7.0 counterparts
|
||
|
|
$mapping = [
|
||
|
|
'fa-file-alt' => 'fa-file-text-o',
|
||
|
|
'fa-calendar-alt' => 'fa-calendar',
|
||
|
|
'fa-money-bill-wave' => 'fa-money',
|
||
|
|
'fa-file-signature' => 'fa-pencil-square-o',
|
||
|
|
'fa-external-link-alt' => 'fa-external-link',
|
||
|
|
'fa-map-marked-alt' => 'fa-map-marker',
|
||
|
|
'fa-file-download' => 'fa-download',
|
||
|
|
'fa-book-open' => 'fa-book',
|
||
|
|
'fa-user-edit' => 'fa-edit',
|
||
|
|
'fa-user-plus' => 'fa-user-plus', // Same in both but ensuring standard
|
||
|
|
'fa-bullhorn' => 'fa-bullhorn',
|
||
|
|
'fa-trophy' => 'fa-trophy',
|
||
|
|
'fa-university' => 'fa-university',
|
||
|
|
'fa-graduation-cap' => 'fa-graduation-cap',
|
||
|
|
'fa-landmark' => 'fa-bank',
|
||
|
|
'fa-info-circle' => 'fa-info-circle',
|
||
|
|
'fa-question-circle' => 'fa-question-circle',
|
||
|
|
'fa-exclamation-triangle' => 'fa-warning',
|
||
|
|
'fa-gavel' => 'fa-gavel',
|
||
|
|
'fa-home' => 'fa-home',
|
||
|
|
'fa-users' => 'fa-users',
|
||
|
|
'fa-shopping-cart' => 'fa-shopping-cart',
|
||
|
|
'fa-camera' => 'fa-camera',
|
||
|
|
'fa-list-ul' => 'fa-list-ul',
|
||
|
|
'fa-phone' => 'fa-phone',
|
||
|
|
'fa-envelope' => 'fa-envelope',
|
||
|
|
'fa-facebook' => 'fa-facebook',
|
||
|
|
'fa-twitter' => 'fa-twitter',
|
||
|
|
'fa-google' => 'fa-google-plus',
|
||
|
|
'fa-linkedin' => 'fa-linkedin',
|
||
|
|
'fa-search' => 'fa-search',
|
||
|
|
'fa-lock' => 'fa-lock',
|
||
|
|
'fa-close' => 'fa-close',
|
||
|
|
'fa-bars' => 'fa-bars',
|
||
|
|
'fa-chevron-down' => 'fa-chevron-down',
|
||
|
|
];
|
||
|
|
|
||
|
|
foreach ($mapping as $old => $new) {
|
||
|
|
$this->execute("UPDATE cms_menu_frontend SET icon = 'fa $new' WHERE icon = 'fa $old' OR icon = '$old'");
|
||
|
|
}
|
||
|
|
|
||
|
|
// Cleanup any double "fa fa"
|
||
|
|
$this->execute("UPDATE cms_menu_frontend SET icon = REPLACE(icon, 'fa fa ', 'fa ') WHERE icon LIKE 'fa fa %'");
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* {@inheritdoc}
|
||
|
|
*/
|
||
|
|
public function safeDown()
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|