I ran across some example code that looks like this:
$form['#submit'][] = 'annotate_admin_settings_submit';
Why is there a bracket after ['#submit'] that is empty with nothing inside? What does this imply? Can anyone give me an example? Normally (from my understanding which is probably wrong) is that arrays have keys and in this case the the $form array key '#submit' is equal to 'annotate_admin_settings_submit' but what is the deal with the second set of brackets. I've seen examples where an array might look like:
$form['actions']['#type'] = 'actions';
I know this is a very basic question about php in general but I ran across this question while learning Drupal so hopefully someone in the Drupal community can clarify this question that I'm obsessing over.
[]
, note that adding such elements to#submit
means you ask Drupal to execute that function in addition to current ones. If you don't want to remove existing submit handlers but further process the form values, this is how you do it. – Event