Hi,
I was trying to add a button to the “Actions” dropdown on the Contacts Detail View.
-
The following code works fine when added in ./custom/modules/Contacts/metadata/detailviewdefs.php
-
From the documentation on the Extension Framework, I thought it would be better practice to put this code in its own file under ./custom/Extension/modules/Contacts/Ext/Vardefs/my_button.php
It works fine in the first case, but it does nothing in Extension. All permissions are verified and correct. Of course, I do a Quick Repair & Rebuild in both cases.
Does anyone have an idea about what I could do to make this work within the Extension framework? It seems better practice, and it would be easier to replicate some customization across clients.
<?php
// define button
$mybutton = array(
'customCode' => '<input type="button" class="button" onclick="
message = \'{$bean->first_name} {$bean->last_name}\\n\';
message += \'{$bean->phone_mobile}\\n\';
message += \'{$bean->email1}\\n\';
navigator.clipboard.writeText(message);
alert(\'Copied contact details!\');"
value="Copy details">',
);
// add button
$viewdefs['Contacts']['DetailView']['templateMeta']['form']['buttons'][4]=$mybutton;
?>
Thanks in advance if you have any thoughts !