text->value($currentLanguage);
}
/**
* This method will be executed to create the preview in StyleEdit
*
* @param Language|null $currentLanguage
*
* @return string
*/
public function previewContent(?Language $currentLanguage): string
{
return $this->htmlContent($currentLanguage) . ' not visible outside of StyleEdit4';
}
/**
* Executed only upon saving
*/
public function persist(): void
{
file_put_contents(__DIR__ . '/ExampleWidget.txt', 'This methods is only executed upon saving');
}
/**
* Specify data which should be serialized to JSON
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by json_encode,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize()
{
$result = $this->jsonObject;
$result->fieldsets = $this->fieldsets;
return $result;
}
}