コード例 #1
0
 protected function getAddLink(ContentEntityInterface $host)
 {
     $link = '';
     if ($host->access('update', \Drupal::currentUser())) {
         $link = '<ul class="action-links action-links-field-collection-add"><li>';
         $link .= \Drupal::l(t('Add'), Url::FromRoute('field_collection_item.add_page', ['field_collection' => $this->fieldDefinition->getName(), 'host_type' => $host->getEntityTypeId(), 'host_id' => $host->id()]));
         $link .= '</li></ul>';
     }
     return $link;
 }