You are here

public static function BlockUploadManager::blockUploadGetFieldList in Block Upload 8

Returns avaliable field list of filefield type.

Return value

array Field list.

1 call to BlockUploadManager::blockUploadGetFieldList()
BlockUploadBlock::blockForm in src/Plugin/Block/BlockUploadBlock.php

File

src/BlockUploadManager.php, line 57

Class

BlockUploadManager
BlockUploadManager class.

Namespace

Drupal\block_upload

Code

public static function blockUploadGetFieldList() {
  $fields = [];
  $results = \Drupal::entityQuery('field_storage_config')
    ->execute();
  foreach ($results as $result) {
    $field = FieldStorageConfig::loadByName(explode('.', $result)[0], explode('.', $result)[1]);
    if ($field
      ->getType() == 'image' || $field
      ->getType() == 'file') {
      $fields[$result] = $result;
    }
  }
  return $fields;
}