Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
3 changes: 1 addition & 2 deletions Block/System/Config/Connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ public function __construct(
private Config $config,
array $data = [],
?SecureHtmlRenderer $secureRenderer = null
){
) {
parent::__construct($context, $data, $secureRenderer);
}


/**
* Return element html
*
Expand Down
2 changes: 1 addition & 1 deletion Block/System/Config/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
private Config $config,
array $data = [],
?SecureHtmlRenderer $secureRenderer = null
){
) {
parent::__construct($context, $data, $secureRenderer);
}

Expand Down
2 changes: 1 addition & 1 deletion Block/System/Config/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
private Config $config,
array $data = [],
?SecureHtmlRenderer $secureRenderer = null
){
) {
parent::__construct($context, $data, $secureRenderer);
}

Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Config/WebhooksAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function execute()
$counter = 0;
foreach ($data['data']['models'] as $model) {

if($this->config->getFallbackEditor($store)) {
if ($this->config->getFallbackEditor($store)) {
$preview_url = self::FALLBACK_EDITOR_URL;
} else {
$preview_url = $this->config->getStoreUrl($store) . 'builderio/preview/page?model=' . $model['name'];
Expand Down
4 changes: 2 additions & 2 deletions Helper/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function __construct(
* Log an error message.
*
* @param string $message
* @param $resource
* @param mixed $resource
* @return void
*/
public function logError(string $message = "", $resource = null): void
public function logError(string $message = "", mixed $resource = null): void
{
$this->logger->error(
self::LOG_PREFIX .
Expand Down
10 changes: 8 additions & 2 deletions Model/Config/Source/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@
*/
class Pages implements OptionSourceInterface
{
/**
* Pages constructor.
*
* @param ContentPageRepository $contentPageRepository
* @param SearchCriteriaBuilder $searchCriteriaBuilder
*/
public function __construct(
private ContentPageRepository $contentPageRepository,
private SearchCriteriaBuilder $searchCriteriaBuilder
){
) {
}

/**
Expand All @@ -35,7 +41,7 @@ public function toOptionArray()
$searchCriteria = $this->searchCriteriaBuilder->create();
$pages = $this->contentPageRepository->getList($searchCriteria);

if($pages->getTotalCount()) {
if ($pages->getTotalCount()) {
$items = $pages->getItems();
foreach ($items as $page) {
$options[] = ['value' => $page->getId(), 'label' => $page->getTitle()];
Expand Down
9 changes: 4 additions & 5 deletions Model/ContentPageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ public function save(ContentPageInterface $contentPage): ContentPageInterface
$exception
);
} catch (\Throwable $exception) {
// todo fix the exception handling
// throw new CouldNotSaveException(
// __('Could not save the webhook: %1', __('Something went wrong while saving the ContentPage.')),
// $exception
// );
throw new CouldNotSaveException(
__('Could not save the content page: %1', $exception->getMessage()),
$exception
);
}

return $contentPage;
Expand Down
2 changes: 1 addition & 1 deletion Model/PageUrlRewriteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PageUrlRewriteGenerator
/**
* Entity type code
*/
const ENTITY_TYPE = 'builderio-page';
public const ENTITY_TYPE = 'builderio-page';

/**
* Page model
Expand Down
7 changes: 6 additions & 1 deletion Model/Queue/Handler/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function processPage()
$api = PageService::API_HTML_PAGE_ENDPOINT;

// Check if the URL contains a widget if it does use the Qwik API
if( str_contains($this->webhook->getWebhookData(), "{{widget") ) {
if (str_contains($this->webhook->getWebhookData(), "{{widget")) {
$api = PageService::API_QWIK_PAGE_ENDPOINT;
}

Expand Down Expand Up @@ -138,6 +138,11 @@ private function processPage()
}
}

/**
* Delete the page associated with the webhook.
*
* @return void
*/
private function deletePage()
{
try {
Expand Down
4 changes: 2 additions & 2 deletions Model/WebhookModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function __construct(
Context $context,
Registry $registry,
private Json $json,
AbstractResource $resource = null,
AbstractDb $resourceCollection = null,
?AbstractResource $resource = null,
?AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
Expand Down
4 changes: 2 additions & 2 deletions Plugin/Magento/Store/Model/PathConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function afterGetDefaultPath(PathConfigMagento $subject, string $result):
$store = $this->storeManager->getStore();
$value = $this->config->isCmsHomepageEnabled($store->getId());

if($value) {
if ($value) {
$page_id = $this->config->getCmsHomepage($store->getId());
if($page_id) {
if ($page_id) {
return 'builderio/view/index/id/' . $page_id;
}
}
Expand Down
1 change: 1 addition & 0 deletions System/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public function getMappedWorkspaceFromStore($storeId = null)
/**
* Check if the Builder.io integration is enabled.
*
* @param null|int|string $storeId
* @return bool
*/
public function isCmsHomepageEnabled($storeId = null)
Expand Down