I have the following code in a custom submit handler:
$status = Drupal::messenger()->messagesByType('status'); foreach ($status as $delta) { // Here I want to extract the text string that is in $delta. }
The variable $delta
now contains this:
delta => stdClass Object ( [__CLASS__] => DrupalCoreRenderMarkup [string:protected] => Article request My article has been created. )
How do I get the protected string from $delta
?
I’ve already tried some methods, but so far I haven’t found one that works.
Here are those tried so far:
Error: Call to undefined method DrupalCoreRenderMarkup::getMessages()
Error: Call to undefined method DrupalCoreRenderMarkup::toString()