Example #1
0
 /**
  * Find out if a link should be provided to an object, instead of just a
  * reference to its name
  *
  * @param  \Model $model   The model to test
  * @param  bool   $linkAll Whether to link deleted and inactive models
  * @param  array  $context Twig's context
  * @return bool
  */
 private function isLinkable($model, $linkAll, &$context)
 {
     // Models that don't have a URL can't be linked
     if (!$model instanceof \UrlModel) {
         return false;
     }
     if ($linkAll) {
         return true;
     }
     if (!$context['app']) {
         // Only link active models by default
         return $model->isActive();
     }
     return $context['app']->getController()->canSee($model);
 }