/**
  * Action to display the widget
  * @return null
  */
 public function indexAction(OrmManager $orm, ContentService $contentService, I18n $i18n, ReflectionHelper $reflectionHelper, $id = null)
 {
     $contentProperties = $this->getContentProperties();
     $modelName = $contentProperties->getModelName();
     if (!$modelName) {
         return;
     }
     $action = $contentProperties->getNoParametersAction();
     if ($id === null) {
         if ($action != ContentProperties::NONE_IGNORE) {
             $this->response->setStatusCode(Response::STATUS_CODE_NOT_FOUND);
         }
         return;
     }
     $this->entryFormatter = $orm->getEntryFormatter();
     $this->model = $orm->getModel($modelName);
     $query = $this->getModelQuery($contentProperties, $this->locale, $id);
     $content = $this->getResult($contentProperties, $contentService, $query);
     if (!$content && $contentProperties->getIncludeUnlocalized()) {
         // no content, look for localized version
         $locales = $i18n->getLocaleList();
         foreach ($locales as $localeCode => $locale) {
             if ($localeCode == $this->locale) {
                 continue;
             }
             $query = $this->getModelQuery($contentProperties, $localeCode, $id);
             $content = $this->getResult($contentProperties, $contentService, $query);
             if ($content) {
                 break;
             }
         }
     }
     if (!$content && $contentProperties->getIdField() != ModelTable::PRIMARY_KEY) {
         // no content, look for slug in history and redirect if possible
         $entryId = $this->getIdFromLog($orm, $reflectionHelper, $contentProperties, $this->locale, $id);
         if ($entryId) {
             $url = $this->getUrl('detail', array('id' => $entryId));
             $this->response->setRedirect($url, Response::STATUS_CODE_MOVED_PERMANENTLY);
             return;
         }
     }
     if ($content && $content->data instanceof LocalizedEntry && !$content->data->isLocalized() && !$contentProperties->getIncludeUnlocalized()) {
         $content = null;
     }
     if (!$content) {
         if ($action != ContentProperties::NONE_IGNORE) {
             $this->response->setStatusCode(Response::STATUS_CODE_NOT_FOUND);
         }
         return;
     }
     $this->setContext('content', $content);
     $url = $this->request->getBaseScript() . $this->properties->getNode()->getRoute($this->locale) . '/' . $id;
     $this->addBreadcrumb($url, $content->title);
     if ($contentProperties->getTitle()) {
         $this->setPageTitle($content->title);
     }
     $this->setView($contentProperties, $content);
     if ($contentProperties->getMetaOg()) {
         $this->setMetaOg($contentProperties, $content, $this->dependencyInjector->get('ride\\library\\image\\ImageUrlGenerator'));
     }
     if ($this->properties->getWidgetProperty('region')) {
         $this->setIsRegion(true);
     }
     if ($this->properties->getWidgetProperty('section')) {
         $this->setIsSection(true);
     }
     if ($this->properties->getWidgetProperty('block')) {
         $this->setIsBlock(true);
     }
 }