Breadcrumb or page name as form subject

Permalink
I have a form block in most pages and when people submit the form, my client wants either page title or breadcrumb to be the subject, so that he knows from which page the user is contacting him.

I have breadcrumb block in scrapbook called "bread".

I tried the following on form block/form/controller.php

//page title
$subject = $c->getCollectionName();
$mh->setSubject(t($subject, $this->surveyName));

//Breadcrumb
$subject = Block::getByName('bread');
$mh->setSubject(t($subject, $this->surveyName));

But no success. Can someone please help me.

twomoons
 
hutman replied on at Permalink Reply
hutman
I think you need to remove some stuff from the page title one - it should look more like this:

$mh->setSubject($subject);


or

$mh->setSubject("Form submission on page %s", $subject);


For the second one, there's no way that will work. The object you get back is not string, so there is no way to use it to set the subject.