Skip to content

Commit

Permalink
form functions handled in retrofit-drupal#73
Browse files Browse the repository at this point in the history
  • Loading branch information
mglaman authored and darrenoh committed Nov 7, 2023
1 parent d436252 commit 43ee7c0
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/functions/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,6 @@

declare(strict_types=1);

use Drupal\Core\Form\FormStateInterface;
use Retrofit\Drupal\Form\DrupalGetForm;
use Retrofit\Drupal\Form\ArrayAccessFormState;

/**
* @param mixed[] $form_state
* @return mixed[]
*/
function drupal_build_form(string $form_id, array &$form_state): array
{
$form_object = \Drupal::classResolver(DrupalGetForm::class);
$form_object->setFormId($form_id);
$original_form_state = $form_state;
$form_state = new ArrayAccessFormState();
foreach ($original_form_state as $offset => $value) {
$form_state[$offset] = $value;
}
return \Drupal::formBuilder()->buildForm($form_object, $form_state);
}

/**
* @return mixed[]
*/
function drupal_get_form(string $form_id): array
{
$form_object = \Drupal::classResolver(DrupalGetForm::class);
$form_object->setFormId($form_id);
return \Drupal::formBuilder()->getForm($form_object);
}

function form_load_include(
FormStateInterface &$form_state,
string $type,
string $module,
?string $name = null
): string|false {
return $form_state->loadInclude($module, $type, $name);
}

function form_set_error($name = null, $message = '', $limit_validation_errors = null)
{
$form = &drupal_static(__FUNCTION__, array());
Expand Down

0 comments on commit 43ee7c0

Please sign in to comment.