| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace cx_newsletter;
- trait activity_fail {
- protected function is_failed() : bool {
- return $this->error !== null;
- }
- protected function get_error_site_params() : array {
- return [
- 'content' => $this->error,
- 'type' => 'toast-error'
- ];
- }
- protected function fail(
- string|\cx_appengine\string_builder $content
- ) : self {
- if (!is_string($content)) {
- $content = $content->get();
- }
- $this->error = __($content, 'cx_newsletter');
- return $this;
- }
-
- protected function get_error_template() : \cx_appengine\template {
- return (
- $this
- ->get_templates()
- ->prepare('only_toast_site')
- );
- }
- protected function construct_fail() : self {
- $this->error = null;
- return $this;
- }
- private ?string $error;
- }
|