Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Link.php
Go to the documentation of this file.
1 <?php
13 
15 
16 class Link extends AbstractElement
17 {
24  public function __construct(
25  Factory $factoryElement,
26  CollectionFactory $factoryCollection,
27  Escaper $escaper,
28  $data = []
29  ) {
30  parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
31  $this->setType('link');
32  }
33 
39  public function getElementHtml()
40  {
41  $html = $this->getBeforeElementHtml() . '<a id="' . $this->getHtmlId() . '" ' . $this->serialize(
42  $this->getHtmlAttributes()
43  ) . $this->_getUiId() . '>' . $this->getEscapedValue() . "</a>\n" . $this->getAfterElementHtml();
44  return $html;
45  }
46 
52  public function getHtmlAttributes()
53  {
54  return [
55  'charset',
56  'coords',
57  'href',
58  'hreflang',
59  'rel',
60  'rev',
61  'name',
62  'shape',
63  'target',
64  'accesskey',
65  'class',
66  'dir',
67  'lang',
68  'style',
69  'tabindex',
70  'title',
71  'xml:lang',
72  'onblur',
73  'onclick',
74  'ondblclick',
75  'onfocus',
76  'onmousedown',
77  'onmousemove',
78  'onmouseout',
79  'onmouseover',
80  'onmouseup',
81  'onkeydown',
82  'onkeypress',
83  'onkeyup',
84  'data-role',
85  'data-action'
86  ];
87  }
88 }
serialize($attributes=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')