Load fields for a user

@param  string $type

@return array
777052
protected function loadFields($type)
    {
        $options = $this->getUtils()->getOptions();

        $typeMap = $type . 'FieldMap';

        $fields = array();
        foreach ($this->$typeMap as $fieldName => $fieldValue) {
            if (isset($options[$fieldValue])) {
                $fields[$fieldName] = $options[$fieldValue];
            }
        }

        return $fields;
    }
986450
public function getStructure(string $type = null): array
    {
        return [
            'email' => $this->makeField(trans('HCCore::users.label.email'))
                ->email()
                ->isRequired()
                ->toArray(),
        ];
    }
602527
public function get_installed_plugins($type) {
        $this->load_installed_plugins();
        if (isset($this->installedplugins[$type])) {
            return $this->installedplugins[$type];
        }
        return array();
    }
166547
public function listContents($type)
    {
        $names = [];
        $files = $this->listFiles($type);

        foreach ($files as $file) {
            $names[] = static::getName($file);
        }

        return $names;
    }
1242866
public function getStructure(string $type = null): array
    {
        return [
            'email' => $this->makeField(trans('HCCore::users.label.email'))
                ->email()
                ->isRequired()
                ->toArray(),
            'password' => $this->makeField(trans('HCCore::users.label.new_password'))
                ->password()
                ->isRequired()
                ->toArray(),
            'password_confirmation' => $this->makeField(trans('HCCore::users.label.new_password_confirmation'))
                ->password()
                ->isRequired()
                ->toArray(),
            'token' => $this->makeField('')
                ->isHidden()
                ->isRequired()
                ->setValue(request()->input('token'))
                ->toArray(),
        ];
    }
927116
public function get(string $type): array
    {
        if (isset($this->messages[$type])) {
            $messages = $this->messages[$type];

            // Clear messages
            $this->clear($type);

            return $messages;
        } else {
            return [];
        }
    }
1056492
public function getConfig($type)
    {
        if (null !== $this->cachedConfig) {
            return $this->cachedConfig[$type];
        }

        $this->loadConfig();

        return $this->cachedConfig[$type];
    }
816480
private function doLoadMetadata($type)
    {
        if (null !== $meta = $this->getFromMemory($type)) {
            $this->dispatchMetadataEvent(Events::onMetadataCacheLoad, $meta);
            // Found in memory.
            return $meta;
        }

        if (null !== $meta = $this->getFromCache($type)) {
            // Found in cache.
            $this->dispatchMetadataEvent(Events::onMetadataCacheLoad, $meta);
            $this->setToMemory($meta);
            return $meta;
        }
        return null;
    }
630468
public function getProfileFields($profile_type_id) {
    $fields = [];

    // Use storage to get only the profile fields of the current bundle type.
    try {
      $profile_fields = $this->entityTypeManager->getStorage('field_config')->loadByProperties(['entity_type' => 'profile', 'bundle' => $profile_type_id]);
    }
    catch (\Exception $e) {
      return $fields;
    }

    // Loop through the fields and return the necessary values.
    /** @var \Drupal\Core\Field\FieldConfigInterface $profile_field */
    foreach ($profile_fields as $profile_field) {
      // Rewrite the ID a bit, since otherwise config thinks it's an array.
      $id = str_replace('.', '_', $profile_field->id());
      // Build the array.
      $fields[$id] = [
        'id' => $id,
        'name' => $profile_field->getName(),
        'label' => $profile_field->getLabel(),
      ];
    }

    // Return the array of fields.
    return $fields;
  }
1014322
public function getConfig($type = self::CONFIG_ALL)
    {
        if ($type == self::CONFIG_ALL) {
            return $this->config;
        }

        return isset($this->config[$type]) ? $this->config[$type] : [];
    }
331097
public function load($resource, $type = null)
    {
        if ($this->loaded) {
            throw new \RuntimeException('Do not add this loader twice');
        }

        $routes = new RouteCollection();

        $routes->addCollection(
            $this->addPluginsRoutesCollection()
        );

        $this->loaded = true;

        return $routes;
    }
117811
public function templates($type)
    {
        $data      = [];
        $extension = $this->repository->findOrFail($type);
        foreach ($extension->param('templates') as $template) {
            $data[] = ['key' => $template['path'], 'value' => $template['description']];
        }

        return response()->json([
            'template' => $data[0]['key'],
            'selected' => $type,
            'data'     => $data,
        ], 200);
    }
702067
public function loadKey($type)
    {
        if (!in_array($type, [self::TYPE_PUBLIC, self::TYPE_PRIVATE])) {
            throw new \InvalidArgumentException(sprintf('The key type must be "public" or "private", "%s" given.', $type));
        }

        $rawKey = file_get_contents($this->getKeyPath($type));
        $key    = call_user_func_array("openssl_pkey_get_$type", self::TYPE_PRIVATE == $type ? [$rawKey, $this->getPassphrase()] : [$rawKey]);

        if (!$key) {
            $sslError = '';
            while ($msg = trim(openssl_error_string(), " \n\r\t\0\x0B\"")) {
                if ('error:' === substr($msg, 0, 6)) {
                    $msg = substr($msg, 6);
                }
                $sslError .= "\n $msg";
            }

            throw new \RuntimeException(
                sprintf('Failed to load %s key: %s', $type, $sslError)
            );
        }

        return $key;
    }
396145
public function getNodesOfType(string $type): array
    {
        return isset($this->nodesByType[$type]) ? $this->nodesByType[$type] : [];
    }
199686
public function getFieldObjectByName($field, $type)
    {
        $info = false;

        //we want to get the correct options depending on the type of field it is
        if ($type === 'filter') {
            $fields = $this->getFilters();
        } else {
            $fields = $this->getEditFields();
        }

        //iterate over the fields to get the one for this $field value
        foreach ($fields as $key => $val) {
            if ($key === $field) {
                $info = $val;
            }
        }

        return $info;
    }
898094
public function getStructure(string $type = null): array
    {
        return [
            'email' => $this->makeField(trans('HCCore::users.label.email'))
                ->email()
                ->isRequired()
                ->toArray(),
            'password' => $this->makeField(trans('HCCore::users.label.password'))
                ->password()
                ->isRequired()
                ->toArray(),
            'password_confirmation' => $this->makeField(trans('HCCore::users.label.password_confirmation'))
                ->password()
                ->isRequired()
                ->toArray(),
        ];
    }
7555
public static function items($type)
	{
		if(!isset(self::$_items[$type]))
			self::loadItems($type);
		return self::$_items[$type];
	}