How can I know which button was clicked?
You must use $form_state-&gt;getTriggeringElement().

Best practice is to define a #name attribute for your button, so you can have this value in the triggering_element. 

For example:

$form['delete'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; t('Delete'),
  '#name' =&gt; 'delete',
);


In this example:
$form_state-&gt;getTriggeringElement()['#name'] will return "delete" when called within public function submitForm(&amp;$form, $form_state)

If you don't define this attribute triggering_element will hold the button's #value (the text that user can read), but this is discouraged as other modules may change this value or be changed by the localization).

You may use $form_state['clicked_button'] too, but this is deprecated.

You can read more info at the drupal_build_form function documentation page.