You are here

public function BlockUploadBlock::blockUploadAjaxCallback in Block Upload 8

Display fields checkboxes depends on selected field.

File

src/Plugin/Block/BlockUploadBlock.php, line 125

Class

BlockUploadBlock
Provides a Custom block.

Namespace

Drupal\block_upload\Plugin\Block

Code

public function blockUploadAjaxCallback(array &$form, FormStateInterface $form_state) {
  $block_upload_id = $form_state
    ->getValue([
    'settings',
    'block_upload_id',
  ]);
  if (empty($form_state
    ->getValue([
    'settings',
    'block_upload_' . $block_upload_id . '_field',
  ]))) {
    return;
  }
  $field_name = $form_state
    ->getValue([
    'settings',
    'block_upload_' . $block_upload_id . '_field',
  ]);
  $field = field_info_field($field_name);
  BlockUploadManager::blockUploadFieldOptionsFormElements($form, $block_upload_id, $field['type']);
  return $form['config'];
}