PHP code example of tombroucke / sage
1. Go to this page and download the library: Download tombroucke/sage library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tombroucke / sage example snippets
ThemeJson::colors()->pluck('name', 'slug');
// app/Providers/ThemeServiceProvider.php
$this->app->bind('icons', function() {
return Cache::rememberForever('fontawesome-icons', function () {
$icons = [];
$sets = app()->make('BladeUI\Icons\Factory')->all();
foreach ($sets as $setname => $set) {
if (strpos($setname, 'fontawesome') === false) {
continue;
}
$niceSetName = str_replace('fontawesome-', '', $setname);
foreach ($set['paths'] as $path) {
$files = glob($path . '/*.svg');
foreach ($files as $file) {
$iconBasename = basename($file, '.svg');
$iconName = $set['prefix'] . '-'. $iconBasename;
$icons[$iconName] = "$iconBasename $niceSetName";
}
}
}
return $icons;
});
});
// app/Blocks/BlockWithIcons.php
...
->addSelect('icon', [
'label' => __('Icon', 'sage'),
'choices' => app()->make('icons'),
'default_value' => 'fas-star',
'ajax' => 1,
])
...