Harings Rob
11/17/2021, 5:22 PMHarings Rob
11/17/2021, 5:22 PM// Requires middleware `LaravelSessionRedirect.php`.
//
// Automatically determine locale from browser (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language)
// on first call if it's not defined in the URL. Redirect user to computed localized url.
// For example, if users browser language is `de`, and `de` is active in the array `supportedLocales`,
// the `/about` would be redirected to `/de/about`.
//
// The locale will be stored in session and only be computed from browser
// again if the session expires.
//
// If false, system will take app.php locale attributeSami
11/17/2021, 5:25 PMSami
11/17/2021, 5:25 PMHarings Rob
11/17/2021, 5:26 PMSami
11/17/2021, 5:35 PMSami
11/17/2021, 5:45 PMSami
11/17/2021, 5:45 PMimage.blade.php block but in Block Editor it shows up.Sami
11/17/2021, 5:46 PMblocks in our Block Editor fieldsSami
11/17/2021, 5:49 PMifox
11/17/2021, 5:56 PMifox
11/17/2021, 5:57 PM'use_twill_blocks' => [],ifox
11/17/2021, 5:57 PMSami
11/17/2021, 5:58 PMSami
11/17/2021, 5:58 PMGenia
11/18/2021, 7:25 AMSami
11/18/2021, 7:10 PMlinkable using columns linkable_id and linkable_type in one of the entities.Sami
11/18/2021, 7:10 PMlinkable_id gets filled, linkable_type is nullSami
11/18/2021, 7:11 PMlinkable_type in the database just to see if the browser would be filled correctly after refresh but then I get an error saying that admin.linkable.edit is not definedSami
11/18/2021, 7:31 PMpboivin
11/18/2021, 7:38 PMpboivin
11/18/2021, 8:04 PMafterSave() and getFormFields() ?Sami
11/18/2021, 8:09 PMphp
public function getFormFields($object)
{
$fields = parent::getFormFields($object);
$fields['browsers']['linkable'] = $this->getFormFieldsForBrowser($object, 'linkable');
return $fields;
}
public function afterSave($object, $fields)
{
$this->updateBrowser($object, $fields, 'linkable');
parent::afterSave($object, $fields);
}pboivin
11/18/2021, 8:13 PMupdateBrowser() has anything special to work with polymorphic relationships... Have you tried manually saving the linkable data on $object?Sami
11/18/2021, 8:14 PMpboivin
11/18/2021, 8:15 PMrookiespoiler
11/19/2021, 2:48 PMagnonym
11/19/2021, 2:58 PMDB::table(config('twill.mediables_table'))->insertGetId([
'mediable_id' => $model->id,
'mediable_type' => $this->modelName,
'media_id' => $image->id,
'crop_x' => 0,
'crop_y' => 0,
'crop_w' => $image->width,
'crop_h' => (0 === $params['ratio'] ? $image->height : ($image->width / $params['ratio'])),
'role' => $role,
'crop' => $crop,
'ratio' => $params['name'],
'metadatas' => json_encode(['video' => null, 'altText' => $image->alt_text, 'caption' => null]),
'locale' => config('twill.locale'),
'created_at' => $model->created_at,
]);pboivin
11/19/2021, 3:15 PMpboivin
11/19/2021, 3:15 PM