How to find the pressed button Help me please. How can I get the value of the pressed button. Thanks!

$items = [];

foreach ($result as &amp;$value) {
  $items[] = [
    $form['repo'] = [
      '#type' =&gt; 'fieldset',
      '#title' =&gt; $this
        -&gt;t('FIELD REPO'),
    ],
    $form['repo']['repo_name'] = [
      '#type' =&gt; 'item',
      '#title' =&gt; $value-&gt;name,
    ],
    $form['repo']['user_name'] = [
      '#type' =&gt; 'hidden',
      '#title' =&gt; $value-&gt;name,
      '#value' =&gt; $value-&gt;name,
    ],
    $form['repo']['submit'] = [
      '#type' =&gt; 'submit',
      '#value' =&gt; $value-&gt;name,
    ],
  ];
}
$form['repositories_arr'] = [
  '#theme' =&gt; 'item_list',
  '#items' =&gt; $items,
  '#attributes' =&gt; ['id' =&gt; 'repositories_arr'],
];




return $form;
In the foreach loop of your example, you create multiple buttons and you can set a different/distinct '#name' property property to each submit button, e.g.:

foreach ($result as &amp;$value) {
  ...
  $form['repo']['submit'] = [
    '#type' =&gt; 'submit',
    '#value' =&gt; $value-&gt;name,
    '#name' =&gt; $value-&gt;name,
  ];
  ...
}


In your validation and/or submit handler you can retrieve the element that triggered the form submission using $form_state-&gt;getTriggeringElement()['#name'].