10-04-2026

This commit is contained in:
Kevin Adametz 2026-04-10 17:18:17 +02:00
parent 4d6b4930b2
commit 4bb89aad8c
836 changed files with 52961 additions and 5950 deletions

View file

@ -2,11 +2,11 @@
namespace FluxCms\StarterComponents\Components;
use Livewire\Component;
use FluxCms\Core\FieldTypes\BooleanField;
use FluxCms\Core\FieldTypes\MediaField;
use FluxCms\Core\FieldTypes\TextField;
use FluxCms\Core\FieldTypes\WysiwygField;
use FluxCms\Core\FieldTypes\MediaField;
use FluxCms\Core\FieldTypes\BooleanField;
use Livewire\Component;
class HeroSection extends Component
{
@ -109,8 +109,8 @@ class HeroSection extends Component
$ctaLink = $content['cta_link'] ?? '';
foreach ($ctaText as $locale => $text) {
if (!empty($text) && empty($ctaLink)) {
$errors["cta_link"] = ['Button link is required when button text is provided'];
if (! empty($text) && empty($ctaLink)) {
$errors['cta_link'] = ['Button link is required when button text is provided'];
break;
}
}
@ -127,24 +127,28 @@ class HeroSection extends Component
protected function getHeadline(?string $locale = null): string
{
$locale = $locale ?? app()->getLocale();
return $this->content['headline'][$locale] ?? '';
}
protected function getSubheadline(?string $locale = null): string
{
$locale = $locale ?? app()->getLocale();
return $this->content['subheadline'][$locale] ?? '';
}
protected function getDescription(?string $locale = null): string
{
$locale = $locale ?? app()->getLocale();
return $this->content['description'][$locale] ?? '';
}
protected function getCtaText(?string $locale = null): string
{
$locale = $locale ?? app()->getLocale();
return $this->content['cta_text'][$locale] ?? '';
}
@ -165,17 +169,17 @@ class HeroSection extends Component
protected function hasCta(): bool
{
return !empty($this->getCtaText()) && !empty($this->getCtaLink());
return ! empty($this->getCtaText()) && ! empty($this->getCtaLink());
}
protected function hasBackgroundImage(): bool
{
return !empty($this->content['background_image']);
return ! empty($this->content['background_image']);
}
protected function getBackgroundImageUrl(): ?string
{
if (!$this->hasBackgroundImage()) {
if (! $this->hasBackgroundImage()) {
return null;
}
@ -222,4 +226,4 @@ class HeroSection extends Component
return implode(' ', $classes);
}
}
}

View file

@ -2,10 +2,10 @@
namespace FluxCms\StarterComponents;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Livewire\Livewire;
use ReflectionClass;
class FluxCmsStarterComponentsServiceProvider extends ServiceProvider
@ -33,7 +33,7 @@ class FluxCmsStarterComponentsServiceProvider extends ServiceProvider
*/
protected function bootViews(): void
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'flux-cms-starter');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'flux-cms-starter');
}
/**
@ -44,12 +44,12 @@ class FluxCmsStarterComponentsServiceProvider extends ServiceProvider
if ($this->app->runningInConsole()) {
// Publish views
$this->publishes([
__DIR__ . '/../resources/views' => resource_path('views/vendor/flux-cms-starter'),
__DIR__.'/../resources/views' => resource_path('views/vendor/flux-cms-starter'),
], 'flux-cms-starter-views');
// Publish components
$this->publishes([
__DIR__ . '/Components' => app_path('Livewire/Components'),
__DIR__.'/Components' => app_path('Livewire/Components'),
], 'flux-cms-starter-components');
}
}
@ -59,21 +59,21 @@ class FluxCmsStarterComponentsServiceProvider extends ServiceProvider
*/
protected function bootLivewireComponents(): void
{
$this->registerLivewireComponentsFrom(__DIR__ . '/Components', 'FluxCms\\StarterComponents\\Components', 'flux-cms-starter::');
$this->registerLivewireComponentsFrom(__DIR__.'/Components', 'FluxCms\\StarterComponents\\Components', 'flux-cms-starter::');
}
protected function registerLivewireComponentsFrom(string $path, string $namespace, string $aliasPrefix = ''): void
{
$filesystem = new Filesystem();
if (!$filesystem->isDirectory($path)) {
$filesystem = new Filesystem;
if (! $filesystem->isDirectory($path)) {
return;
}
foreach ($filesystem->allFiles($path) as $file) {
$class = $namespace . '\\' . str_replace(['/', '.php'], ['\\', ''], $file->getRelativePathname());
$class = $namespace.'\\'.str_replace(['/', '.php'], ['\\', ''], $file->getRelativePathname());
if (class_exists($class) && is_subclass_of($class, \Livewire\Component::class) && !(new ReflectionClass($class))->isAbstract()) {
$alias = $aliasPrefix . Str::kebab(class_basename($class));
if (class_exists($class) && is_subclass_of($class, \Livewire\Component::class) && ! (new ReflectionClass($class))->isAbstract()) {
$alias = $aliasPrefix.Str::kebab(class_basename($class));
Livewire::component($alias, $class);
}
}