Commit c3cad9bd authored by alexpott's avatar alexpott

Issue #2821265 by tim.plunkett: Allow #entity_builders to use the ::Callback shorthand

parent 2daae3fb
......@@ -53,7 +53,7 @@ public function form(array $form, FormStateInterface $form_state) {
$this->getFormDisplay($form_state)->buildForm($this->entity, $form, $form_state);
// Allow modules to act before and after form language is updated.
$form['#entity_builders']['update_form_langcode'] = [$this, 'updateFormLangcode'];
$form['#entity_builders']['update_form_langcode'] = '::updateFormLangcode';
return $form;
}
......
......@@ -294,7 +294,7 @@ public function buildEntity(array $form, FormStateInterface $form_state) {
// properties.
if (isset($form['#entity_builders'])) {
foreach ($form['#entity_builders'] as $function) {
call_user_func_array($function, array($entity->getEntityTypeId(), $entity, &$form, &$form_state));
call_user_func_array($form_state->prepareCallback($function), array($entity->getEntityTypeId(), $entity, &$form, &$form_state));
}
}
......
......@@ -133,7 +133,7 @@ public function form(array $form, FormStateInterface $form_state) {
],
],
];
$form['#entity_builders'][] = [$this, 'formBuilderCallback'];
$form['#entity_builders'][] = '::formBuilderCallback';
return parent::form($form, $form_state);
}
......
......@@ -200,7 +200,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['#attached']['library'][] = 'node/form';
$form['#entity_builders']['update_status'] = [$this, 'updateStatus'];
$form['#entity_builders']['update_status'] = '::updateStatus';
return $form;
}
......
......@@ -265,7 +265,7 @@ public function form(array $form, FormStateInterface $form_state) {
// language. This entity builder provides that synchronization. For
// use-cases where this synchronization is not desired, a module can alter
// or remove this item.
$form['#entity_builders']['sync_user_langcode'] = [$this, 'syncUserLangcode'];
$form['#entity_builders']['sync_user_langcode'] = '::syncUserLangcode';
return parent::form($form, $form_state, $account);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment