ResolveUtility the top-priority ConfigurationPrivider which can provide
a working FlexForm configuration baed on the given parameters.
public resolvePrimaryConfigurationProvider ( string $table, string $fieldName, array $row = NULL, string $extensionKey = NULL ) : FluidTYPO3\Flux\Provider\ProviderInterface | null | ||
$table | string | |
$fieldName | string | |
$row | array | |
$extensionKey | string | |
return | FluidTYPO3\Flux\Provider\ProviderInterface | null |
/** * @throws \RuntimeException * @return void */ protected function initializeProvider() { $row = $this->getRecord(); $table = $this->getFluxTableName(); $field = $this->getFluxRecordField(); $this->provider = $this->configurationService->resolvePrimaryConfigurationProvider($table, $field, $row); if (NULL === $this->provider) { throw new \RuntimeException('Unable to resolve a ConfigurationProvider, but controller indicates it is a Flux-enabled Controller - ' . 'this is a grave error and indicates that EXT: ' . $this->extensionName . ' itself is broken - or that EXT:' . $this->extensionName . ' has been overridden by another implementation which is broken. The controller that ' . 'caused this error was ' . get_class($this) . '".', 1377458581); } }
/** * @param array $parameters * @param PageLayoutView|DatabaseRecordList $caller * @return string */ public function addSubIcon(array $parameters, $caller = NULL) { $this->attachAssets(); list($table, $uid, $record) = $parameters; $icon = NULL; if (NULL !== $caller) { $record = NULL === $record && 0 < $uid ? BackendUtility::getRecord($table, $uid) : $record; $cacheIdentity = $table . $uid . sha1(serialize($record)); // filter 1: icon must not already be cached and both record and caller must be provided. if (TRUE === $this->cache->has($cacheIdentity)) { $icon = $this->cache->get($cacheIdentity); } elseif (NULL !== $record) { $field = $this->detectFirstFlexTypeFieldInTableFromPossibilities($table, array_keys($record)); // filter 2: table must have one field defined as "flex" and record must include it. if (NULL !== $field && TRUE === isset($record[$field])) { // we check the cache here because at this point, the cache key is decidedly // unique and we have not yet consulted the (potentially costly) Provider. $provider = $this->fluxService->resolvePrimaryConfigurationProvider($table, $field, $record); // filter 3: a Provider must be resolved for the record. if (NULL !== $provider) { $form = $provider->getForm((array) $record); if (NULL !== $form) { $icon = MiscellaneousUtility::getIconForTemplate($form); if (NULL !== $icon) { $label = trim($form->getLabel()); $icon = '<img width="16" height="16" src="' . $icon . '" alt="' . $label . '" title="' . $label . '" class="" />'; $icon = sprintf($this->templates['iconWrapper'], $icon); } } } } $this->cache->set($cacheIdentity, $icon); } } return $icon; }