Albert
Albert
TCTwill CMS
Created by Albert on 2/7/2025 in #👊support
handle translations make 'en' as active always
Problem: When we create a page with non english locale, eg) French In module repository create method - (copied only 3 lines from it) $fields = $this->prepareFieldsBeforeCreate($fields); $model = $this->model->make(Arr::except($fields, $this->getReservedFields())); $fields = $this->prepareFieldsBeforeSave($model, $fields); HandleTranslations has the method 'prepareFieldsBeforeSaveHandleTranslations' Its invoked twice for creation. prepareFieldsBeforeCreate => from here we have the languages data so it works fine. prepareFieldsBeforeSave => from here we dont have the languages and taking 'en' as active locale. $submittedLanguages = Collection::make($fields['languages'] ?? []); $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function ($language) { return $language['published']; }); Spent 2 days to figure out this issue..
2 replies
TCTwill CMS
Created by Albert on 1/8/2025 in #👊support
Navigation Link breaks when the primary navigation is a module (upgrading twill3)
Primary menu is visible with 'home page' and 'Projects' for the below array defined in twill-navigation (Yes legacy code) 'home' => [ 'title' => 'Home page', 'route' => 'home', ], 'projects' => [ 'title' => 'Projects', 'module' => true, ] Once I started add primary navigation array application breaks with Route not found exception Here Projects and users are parent child nested modules. protected $moduleName = 'projects.users'; => line from users controller. 'projects' => [ 'title' => 'Projects', 'module' => true, 'primary_navigation' => [ 'users' => [ 'title' => 'Users', 'module' => true, ] ] What am doing wrong here?
3 replies
TCTwill CMS
Created by Albert on 10/21/2024 in #👊support
how to override a default database model class method
Hi team, I’d like to get your opinion on overriding a specific class in Twill. Current approach: Copy the model's content, extend the original model class, and then reference the newly extended class. Is this the correct approach? Let me know your thoughts.
19 replies