We introduced hook_element_info_alter() in #527804: element_info() cannot be altered, which now is kinda detached, because there is no hook_element_info(), but hook_elements() instead.

Simple change. Just grep + replace all instances of '_elements' with '_element_info' throughout core + change the hook invocation in element_info(), common.inc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Reviewed & tested by the community
FileSize
14.89 KB

Pretty much RTBC.

sun’s picture

Status: Reviewed & tested by the community » Needs review

oopsie

Status: Needs review » Needs work

The last submitted patch failed testing.

yched’s picture

Status: Needs work » Needs review

Makes sense, and should be good to go if bot comes back green.

My only nitpick is that the variable name $type looks odd in:

function text_element_info() {
  $type['text_textfield'] = array(
    '#input' => TRUE,    
    // ..
  );
  $type['text_textarea'] = array(
    '#input' => TRUE,
    // ..
  );
  $type['text_textarea_with_summary'] = array(
    '#input' => TRUE,
    // ..
  );
  return $type;
}

Why not $elements ? or $types (plural) ? or simply $return ?

sun’s picture

We use $type everywhere related to element types currently. So all of the contained changes are for consistency only. Renaming $type to $types or $elements might make sense, but I'd prefer to defer to a separate issue ;)

Failed to install HEAD doesn't sound nice... HEAD broken? :/

yched’s picture

"We use $type everywhere related to element types currently".
I'm fine with that, but the returned array should be named $types (plural), then ?

sun’s picture

FileSize
15.24 KB

What a stupid mistake... ;)

sun’s picture

FileSize
21.44 KB

ok, but only because it's you :)

Renamed everything to $types.

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks!

sun’s picture

Status: Fixed » Needs work
Issue tags: +Needs documentation

Needs docs.

Island Usurper’s picture

Status: Needs work » Needs review

Added to update page.

sun’s picture

Status: Needs review » Fixed

Awesome!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.