public function getLink($attributesOrText = null) {
    $text = $this->getText();
    $extraAttributes = null;

    if (is_string($attributesOrText)) {
      // If a string is passed, override the text component
      $text = $attributesOrText;

    } elseif (is_array($attributesOrText)) {
      // If an array is passed, use it as tag attributes
      $extraAttributes = $attributesOrText;
      if (array_key_exists('text', $extraAttributes)) {
        $text = $extraAttributes['text'];
        unset($extraAttributes['text']);
      }
    }

    $attributes = $this->getRawLinkAttributes($extraAttributes);
    if (is_null($attributes) || is_null($text)) {
      return null;
    }

    return Template::raw(Html::tag('a', $text, $attributes));
  }
public function getLink($attributesOrText = null) {
    $text = $this->getText();
    $extraAttributes = null;

    if (is_string($attributesOrText)) {
      // If a string is passed, override the text component
      $text = $attributesOrText;

    } elseif (is_array($attributesOrText)) {
      // If an array is passed, use it as tag attributes
      $extraAttributes = $attributesOrText;
      if (array_key_exists('text', $extraAttributes)) {
        $text = $extraAttributes['text'];
        unset($extraAttributes['text']);
      }
    }

    $attributes = $this->getRawLinkAttributes($extraAttributes);
    if (is_null($attributes) || is_null($text)) {
      return null;
    }

    return Template::raw(Html::tag('a', $text, $attributes));
  }
public function getLink ( $ attributesOrText = null ) { $ text = $ this -> getText ( ) ; $ extraAttributes = null ; if ( is_string ( $ attributesOrText ) ) { // If a string is passed, override the text component $ text = $ attributesOrText ; } elseif ( is_array ( $ attributesOrText ) ) { // If an array is passed, use it as tag attributes $ extraAttributes = $ attributesOrText ; if ( array_key_exists ( 'text' , $ extraAttributes ) ) { $ text = $ extraAttributes [ 'text' ] ; unset ( $ extraAttributes [ 'text' ] ) ; } } $ attributes = $ this -> getRawLinkAttributes ( $ extraAttributes ) ; if ( is_null ( $ attributes ) || is_null ( $ text ) ) { return null ; } return Template :: raw ( Html :: tag ( 'a' , $ text , $ attributes ) ) ; }
Renders a complete link tag.

You can either pass the desired content of the link as a string, e.g.
```
{{ entry.linkField.link('Imprint') }}
```

or you can pass an array of attributes which can contain the key `text`
which will be used as the link text. When doing this you can also override
the default attributes `href` and `target` if you want to.
```
{{ entry.linkField.link({
class: 'my-link-class',
text: 'Imprint',
}) }}
```

@param array|string|null $attributesOrText
@return null|\Twig_Markup
Renders a complete link tag .