Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 481 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract Url & Title from link field in Drupal 8?

#1
I'm trying to retrieve the *URL* and the *Title* values of a [Link field](

[To see links please register here]

) in **Drupal 8**.

In my custom controller, I retrieve the nodes with:

$storage = \Drupal::entityManager()->getStorage('node');
$nids = $storage->getQuery()
->condition('type', 'partners')
->condition('status', 1)
->execute();

$partners = $storage->loadMultiple($nids);

When I loop throught all my nodes, to preprocess vars I'll give to my view, I would like to retrieve the *URL* and the *Title*.

foreach ($partners as $key => $partner) {
$variables['partners'][] = array(
'image' => $partner->field_logo->entity->url(),
'url' => $partner->field_link->value, // Can't retrieve values of link field
);
}

Unfortunately, I don't found how to retrieve the *URL* and the *Title* of **field_link**.

Thanks for your help.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through