PHP code example of 34ml / filament-translatable-field
1. Go to this page and download the library: Download 34ml/filament-translatable-field 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/ */
34ml / filament-translatable-field example snippets
..._34ML\FilamentTranslatableField::make(
'your_translatable_field_name',
\Filament\Forms\Components\TextInput::class, // The field type class
)
..._34ML\FilamentTranslatableField::make(
'your_translatable_field_name',
\Filament\Forms\Components\TextInput::class, // The field type class
'your_field_displayed_name', // Optional
)
..._34ML\FilamentTranslatableField::make(
'your_translatable_field_name',
\Filament\Forms\Components\TextInput::class, // The field type class
// add your filament field functions as a callback, you can add it as one function
callbacks: function (){
$this->
use _34ML\FilamentTranslatableField\Forms\Components\LanguageSelector;
return $form
->schema([
LanguageSelector::make(),
]);
public static function getRecordTitle(?Model $record): ?string
{
return $record->getTranslation('your_title_column', config('filament-translatable-field.locales')[0]);
}