class OurSolutionsUSP extends SubForm
{
- public function getNews() {
+ public function getNews($table) {
$instance = new News();
- return $instance->getDataByTable('cubist_cms_pages');
+ return $instance->getDataByTable($table);
}
public function init()
'label' => 'Image',
'type' => 'Images']);
- $this->addField(['name' => 'page',
- 'label' => 'Lien vers',
+ $this->addField(['name' => 'page_product',
+ 'label' => 'Lien vers une page produit',
'type' => 'SelectFromArray',
- 'options' => self::getNews(),
- 'multiple' => false
+ 'options' => $this->getNews('catalog_products'),
+ 'multiple' => false,
+ 'default' => ''
+ ]);
+
+ $this->addField(['name' => 'page_page',
+ 'label' => 'Lien vers une page generale',
+ 'type' => 'SelectFromArray',
+ 'options' => $this->getNews('cubist_cms_pages'),
+ 'multiple' => false,
+ ]);
+
+ $this->addField(['name' => 'page_news',
+ 'label' => 'Lien vers une page actualités',
+ 'type' => 'SelectFromArray',
+ 'options' => $this->getNews('cubist_news'),
+ 'multiple' => false,
+ ]);
+
+ $this->addField(['name' => 'page_application',
+ 'label' => 'Lien vers une page application',
+ 'type' => 'SelectFromArray',
+ 'options' => $this->getNews('applications'),
+ 'multiple' => false,
]);
}
}
<text-block :title="__('Nos solutions')" title-class="h1 text-inherit" />
<grid cols="3" class="sm:grid-cols-2 xs:grid-cols-1">
@foreach ($our_solutions_items as $item)
- @isset($item['page'])
+ @if(!empty($item['page_product']))
+ @php($prefix = 'product')
+ @php($link = App\Models\Product::find($item['page_product'])->getPageData()['slug'])
+ @elseif(!empty($item['page_page']))
+ @php($prefix = 'page')
+ @php($link = Cubist\Backpack\app\Magic\Menu\Menu::getNavigation()->getHrefByID('page/'.$item['page_page']))
+ @elseif(!empty($item['page_news']))
+ @php($prefix = 'news')
+ @php($link = Cubist\Backpack\app\Magic\Menu\Menu::getNavigation()->getHrefByID('news/'.$item['page_news']))
+ @elseif(!empty($item['page_application']))
+ @php($prefix = 'application')
+ @php($link = Cubist\Backpack\app\Magic\Menu\Menu::getNavigation()->getHrefByID('application/'.$item['page_application']))
+ @endif
+
+
+ @if(!empty($prefix))
<div class="">
- <a href="{{ $nav->getHrefById('product/'.$item['page']) }}">
+ <a href="{{ $link }}">
<div class="bg-cover mb-8" style="padding-bottom: 56.25%; background-image: url({{ $page->getImageURLbyCollection($item['image']) }})">
</div>
</a>
{{ $item['title'] }}
</h3>
<p>{{ $item['text'] }}</p>
- <a href="{{ $nav->getHrefById('product/'.$item['page']) }}">{{ __('Découvrir') }}</a>
+ <a href="{{ $link }}">{{ __('Découvrir') }}</a>
</div>
</div>
@endisset
@if(!empty($item['page_product']))
@php($prefix = 'product')
+ @php($link = App\Models\Product::find($item['page_product'])->getPageData()['slug'])
@elseif(!empty($item['page_page']))
@php($prefix = 'page')
+ @php($link = Cubist\Backpack\app\Magic\Menu\Menu::getNavigation()->getHrefByID('page/'.$item['page_page']))
@elseif(!empty($item['page_news']))
@php($prefix = 'news')
+ @php($link = Cubist\Backpack\app\Magic\Menu\Menu::getNavigation()->getHrefByID('news/'.$item['page_news']))
+ @elseif(!empty($item['page_application']))
+ @php($prefix = 'application')
+ @php($link = Cubist\Backpack\app\Magic\Menu\Menu::getNavigation()->getHrefByID('application/'.$item['page_application']))
@endif
<article>
- <pre style="display: none;">
- <?php dump("prefix",$prefix.'/'.$item['page_'.$prefix]) ?>
- </pre>
-
- <a href="{{ $nav->getHrefById($prefix.'/'.$item['page_'.$prefix]) }}" class="news-index-article-image block bg-grey-100">
+ <a href="{{ $link }}" class="news-index-article-image block bg-grey-100">
<img src="{{ $page->getImageURLbyCollection($item['image']) }}" />
</a>
{{ $item['date'] }}
</time>
<h4 class="text-2xl sm:text-xl">
- <a class="text-navy" href="{{ $nav->getHrefById($prefix.'/'.$item['page_'.$prefix]) }}">
+ <a class="text-navy" href="{{ $link }}">
{{ $item['title'] }}
</a>
</h4>
<p>{{ $item['text'] }}</p>
- <p><a href="{{ $nav->getHrefById($prefix.'/'.$item['page_product']) }}">{{ __("En savoir plus") }}</a></p>
+ <p><a href="{{ $link }}">{{ __("En savoir plus") }}</a></p>
</div>
</article>