/** * Return the translated country name. * * @param null $locale * * @return null|string */ public function translated($locale = null) { if (!($key = $this->object->getValue())) { return; } return trans('websemantics.field_type.country::country.' . $key, [], $locale); }
/** * Handle the options. * * @param SocialFieldType $fieldType */ public function handle(SocialFieldType $fieldType) { $countries = config('websemantics.field_type.social::accounts'); $names = array_map(function ($id) { return 'websemantics.field_type.social::account.' . $id; }, $countries); $options = array_combine($countries, $names); asort($options); $fieldType->setOptions($options); }