luciano.mizra
Explore posts from serversTCTwill CMS
•Created by luciano.mizra on 12/13/2023 in #👊support
Edit defaultOrders in controller
What would be the most correct way to edit?
$this->defaultOrders of ModuleController in my controller, I understand that setting it in setUpController would work, but it is not a public method,
My idea is something similar to this:
$this->enableReorder();
$this->defaultOrders = [ 'publish_start_date' => 'desc'];
2 replies
TCTwill CMS
•Created by luciano.mizra on 9/6/2023 in #👊support
afterReorder
Is it possible to add a function before or after saving the positions of my module?
I need it in order to clear the cache of my site every time the position of the elements changes.
I need something similar to this
<?php
namespace A17\Twill\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\DB;
use A17\Twill\Models\Model;
class ReorderNestedModuleItems implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
protected $modelClass;
protected $ids;
public function __construct(Model $model, array $ids)
{
$this->modelClass = get_class($model);
$this->ids = $ids;
}
public function handle()
{
DB::transaction(function () {
// Here custom function app($this->modelClass)->saveTreeFromIds($this->ids); }, 3); } }
// Here custom function app($this->modelClass)->saveTreeFromIds($this->ids); }, 3); } }
6 replies
TCTwill CMS
•Created by luciano.mizra on 7/20/2023 in #👊support
Injecting Fields from a BladePartial into a Block Form
4 replies
TCTwill CMS
•Created by luciano.mizra on 7/14/2023 in #👊support
DefaultBlocks
Hi!
Is there a way to hardcode the default blocks as well as prevent the user from loading them manually, something like this:
BlockEditor::make()
->defaultBlocks([
[
'name' => 'ContentItems',
'values' => [
'title' => 'Título por defecto'
]
],
[
'name' => 'text',
'values' => [
'text' => 'Texto por defecto'
]
]
])
5 replies