Determines the form ID.
\Drupal\Core\Form\FormInterface|string $form_arg: A form object to use to build the form, or the unique string identifying the desired form. If $form_arg is a string and a function with that name exists, it is called to build the form array.
array $form_state: An associative array containing the current state of the form.
string The unique string identifying the desired form.
function _drupal_form_id($form_arg, &$form_state) {
// If the $form_arg implements \Drupal\Core\Form\FormInterface, add that as
// the callback object and determine the form ID.
if (is_object($form_arg) && $form_arg instanceof FormInterface) {
$form_state['build_info']['callback_object'] = $form_arg;
if ($form_arg instanceof BaseFormIdInterface) {
$form_state['build_info']['base_form_id'] = $form_arg
->getBaseFormID();
}
return $form_arg
->getFormID();
}
// Otherwise, the $form_arg is the form ID.
return $form_arg;
}