public static function InsertViewDialog::getArguments in Advanced Insert View 8
Same name and namespace in other branches
- 2.0.x src/Form/InsertViewDialog.php \Drupal\insert_view_adv\Form\InsertViewDialog::getArguments()
Ajax callback to get the view arguments
Parameters
$form:
FormStateInterface $form_state:
Return value
mixed
File
- src/
Form/ InsertViewDialog.php, line 100
Class
- InsertViewDialog
- Class InsertViewDialog
Namespace
Drupal\insert_view_adv\FormCode
public static function getArguments(&$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$arguments = 0;
$num_args = $form_state
->get('num_args');
if (!empty($values['inserted_view_adv'])) {
$current_view = $values['inserted_view_adv'];
if (!empty($form['#view_arguments'][$current_view])) {
$arguments = count($form['#view_arguments'][$current_view]);
}
}
$num_args += $arguments;
$form_state
->set('num_args', $num_args);
$form_state
->setRebuild(TRUE);
return $form['arguments'];
}