Skip to content

Commit c4c1b0b

Browse files
committed
added lib
1 parent cc2de31 commit c4c1b0b

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

Lib/Api.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* @copyright 2014 Mautic, NP. All rights reserved.
4+
* @author Mautic
5+
*
6+
* @see http://mautic.org
7+
*
8+
* @license MIT http://opensource.org/licenses/MIT
9+
*/
10+
11+
namespace Lof\Mautic\Lib;
12+
13+
/**
14+
* Base API class.
15+
*/
16+
class Api extends \Mautic\Api\Api
17+
{
18+
/**
19+
* Set the base URL for API endpoints.
20+
*
21+
* @param string $url
22+
*
23+
* @return $this
24+
*/
25+
public function setBaseUrl($url)
26+
{
27+
$url = $url ? $url : "";
28+
if ('/' != @substr($url, -1)) {
29+
$url .= '/';
30+
}
31+
32+
if ('api/' != @substr($url, -4, 4)) {
33+
$url .= 'api/';
34+
}
35+
36+
$this->baseUrl = $url;
37+
38+
return $this;
39+
}
40+
}

etc/di.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<preference for="Lof\Mautic\Api\ContactRepositoryInterface" type="Lof\Mautic\Model\ContactRepository"/>
44
<preference for="Lof\Mautic\Api\Data\ContactInterface" type="Lof\Mautic\Model\Contact"/>
55
<preference for="Lof\Mautic\Api\Data\ContactSearchResultsInterface" type="Magento\Framework\Api\SearchResults"/>
6+
<preference for="Mautic\Api\Api" type="Lof\Mautic\Lib\Api"/>
67
<virtualType name="Lof\Mautic\Model\ResourceModel\Contact\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
78
<arguments>
89
<argument name="mainTable" xsi:type="string">lof_mautic_contact</argument>
@@ -53,7 +54,7 @@
5354
</argument>
5455
</arguments>
5556
</type>
56-
57+
5758
<type name="Magento\Customer\Model\AccountManagement">
5859
<plugin name="mautic-abandoned-checkout-save-quote" type="Lof\Mautic\Model\Plugin\AccountManagement" sortOrder="10"/>
5960
</type>

0 commit comments

Comments
 (0)