Files
wticreatorstudio/Modules/PageBuilderPlus/Services/AugmentationService.php
T
2024-02-12 22:54:20 -05:00

40 lines
1.5 KiB
PHP

<?php
namespace Modules\PageBuilderPlus\Services;
class AugmentationService
{
public function __construct() {
//$this->hideLegacyPageBuilderMenu();
}
public static function hideLegacyPageBuilderMenu() {
$theme = app('theme');
if ($theme) {
$theme_name = app('theme')->folder_path;
$path = resource_path('views/backEnd/partials/_sidebar.blade.php');
if (file_exists($path)) {
$update = false;
$content = file_get_contents($path);
if (!preg_match("/page_builder/", $content)) {
$matches = null;
preg_match('/@elseif\(permissionCheck\(@\$menu->backendMenu->route\)\)/', $content, $matches);
if (count($matches) > 0) {
$code = $matches[0];
$snippet = "
@elseif (@\$menu->backendMenu->route == 'page_builder')
@continue
".$code;
$code = $snippet;
$content = preg_replace('/@elseif\(permissionCheck\(@\$menu->backendMenu->route\)\)/', $code, $content);
//file_put_contents($path, $content);
$update = true;
}
}
if ($update) {
file_put_contents($path, $content);
}
}
}
}
}