Jump to content

raw-read fild data with multilanguage content


vanderbreye
 Share

Recommended Posts

hey! i want to read a value from a $page which is a multilanguage-field. 
it is important for me that i get that field NOT language-filtered, so the whole JSON string '{"0":"abdc","1063":"rguer"}'..
is this somehow possible without switching the fileld to not-multilanguage? because i need the filtered output at other places...

is there a possibility to read the RAW data? 

thanks!

Link to comment
Share on other sites

$wire->addHook('Page::getLanguageJson', function(HookEvent $event) {
	$field = $event->arguments(0);
	$json = [];
	foreach($page->getLanguages() as $lang){
		$json["$lang->id"] = $page->getLanguageValue($lang, $field);
	}
	$event->return = json_encode($json);
});

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...