Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292268

Rename #type =>"actions" / EntityFormController::actions to "buttons" or similar

$
0
0

While reviewing #1920686-1: Deleting a menu gives fatal error + the delete button is shown on system menu's. I was confused by protected function actions() was for. The PHPDoc on http://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21E... says:

"Returns an array of supported actions for the current entity form."

;) Not very helpful...

"action" to me, is an HTML attribute on the <form> tag, that describes where the form should post its results to. I was confused why you ever needed more than one "action" on a form.

The body of that function looks like a bunch of definitions of submit buttons (without #type => submit for some reason). I'm mystified therefore why we don't call this "buttons()" or something similarly self-descripting.

Tim said it's because FAPI has a type "actions" so he's just copy/pasting more or less: http://api.drupal.org/api/drupal/developer%21topics%21forms_api_referenc...

The description there says "A wrapper element to group one or more buttons in a form. Use of the 'actions' element as an array key helps to ensure proper styling in themes and to enable other modules to properly alter a form's actions."

So if it's a group of one or more buttons, let's just call it buttons, hm? :)


Viewing all articles
Browse latest Browse all 292268

Trending Articles