1. I have a couple of delegate methods doing the same things, which override a slot that dynamically displays html code based on the user role. The signature looks like this:
block__source_attachment_1_delete_link(){
if ($role == 'GUEST') echo "hello world";
else echo "hello $role";
}
block__source_attachment_2_delete_link(){
if ($role == 'GUEST') echo "hello world";
else echo "hello $role";
}
block__source_attachment_3_delete_link(){
if ($role == 'GUEST') echo "hello world";
else echo "hello $role";
}
......
block__source_attachment_10_delete_link(){
if ($role == 'GUEST') echo "hello world";
else echo "hello $role";
}
It looks so tedious. Is there any way to define only 1 function but would call the proper one, just like the implementation in Dataface_Record::getLink()?
if ( method_exists($delegate, $fieldname."__link") ){
$methodname = $fieldname."__link";
$link = $delegate->$methodname($this);
}
2. What does Dataface_Record::getLink() return? An html link? can you give me an example?
3. Do you have documentation about the regular delegate methods, like fieldname__validate(), after_action_edit(), and beforeUpdate(). I don't know how many and what parameters should be passed into these functions.