1

I have a form element in d8 as follows :

$form['cluster_dropdown'] = array(
    '#type' => 'select',
    '#title' => 'Cluster',
    '#options' => $cluster_options,
    '#default_value' => $cluster_selection,
    '#ahah' => array(
      'path' => 'module_name/admin5/callback',
      'wrapper' => 'dependent-dropdown-wrapper',
      // 'event' => 'change', // default value: does not need to be set explicitly.
    ),
    '#attributes' => array('class' => 'cluster-dropdown'),
  );

But in this case ahah callback is not working , is there gasf/admin5/callback want to replace with routing path as am using this in d6? any idea ?

4

Neither #ahah nor path are used in Drupal 8. Instead of the first, Drupal 8 uses #ajax; instead of the second, it uses url which must be a \Drupal\Core\Url to which to submit the Ajax request.

Finally, callback is a PHP callback, which generally is a full qualified (using a PSR-4 namespace) method name.

Reference

  • in the api it says 'callback' => 'Drupal\config_translation\FormElement\DateFormat::ajaxSample' , how can i give the function path in there ? – Crazyrubixfan Jul 18 '16 at 11:54
  • That is the qualified namespace for a class method, not a path. – kiamlaluno Jul 18 '16 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.