Edit a Company" when dis..." /> Edit a Company" when dis..." /> Edit a Company" when dis..."/>

How do I get Zend_Navigation to work with database defined data?

203 Views Asked by At

I've got a Zend_Navigation component I use to display breadcrumbs on a page. It currently says something like:

"Companies > Edit a Company"

when displaying the edit form. I would like to make it say something like

"Companies > Editing FooBar"

What's the best way to accomplish that?

1

There are 1 best solutions below

0
On

I had the problem that I wanted to show breadcrumbs even when the parent is set to not visible. Drove me nuts until I found the reason. Your problem is not much different, I think.

I have a unique ID set with basically all links; hence, I can fetch all nodes like the following:

// in view scripts
$navObject = $this->navigation()->findOneById($id);
// now you can manipulate the object however you like
$navObject->setLabel('Editing FooBar');

You can find the node by other means, there is findOneBy() method where you have to pass the target object. Once I printed the breadcrumbs I had to reset setVisible(false) to the old value, though. Depending on your needs you might have to reset the label, too.