1<?php
2function show_the_same_modal_with_different_buttons()
3{
4    global $DIC;
5    $factory = $DIC->ui()->factory();
6    $renderer = $DIC->ui()->renderer();
7
8    $modal = $factory->modal()->roundtrip('My Modal 1', $factory->legacy('My Content'))
9        ->withActionButtons([
10            $factory->button()->primary('Primary Action', ''),
11            $factory->button()->standard('Secondary Action', ''),
12        ]);
13
14    $out = '';
15    $button1 = $factory->button()->standard('Open Modal 1', '#')
16        ->withOnClick($modal->getShowSignal());
17    $out .= ' ' . $renderer->render($button1);
18
19    $button2 = $button1->withLabel('Also opens modal 1');
20    $out .= ' ' . $renderer->render($button2);
21
22    $button3 = $button2->withLabel('Does not open modal 1')
23        ->withResetTriggeredSignals();
24    $out .= ' ' . $renderer->render($button3);
25
26    return $out . $renderer->render($modal);
27}
28