/** * Retrieve backend model by field code * * @param string $code * @return File * @throws LocalizedException */ protected function getBackendModel($code) { $metadata = $this->metadataProvider->get(); if (!(isset($metadata[$code]) && isset($metadata[$code]['backend_model']))) { throw new LocalizedException(__('Backend model is not specified for %1', $code)); } return $this->backendModelFactory->createByPath($metadata[$code]['path']); }
/** * Retrieve metadata * * @return array */ protected function getMetadata() { if (!$this->metadata) { $this->metadata = $this->metadataProvider->get(); array_walk($this->metadata, function (&$value) { $value = $value['path']; }); } return $this->metadata; }