ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Api;
|
||||
|
||||
|
||||
use Magento\Framework\Api\SearchCriteriaInterface;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Olegnax\Carousel\Api\Data\CarouselInterface;
|
||||
use Olegnax\Carousel\Api\Data\CarouselSearchResultsInterface;
|
||||
|
||||
interface CarouselRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Save Carousel
|
||||
* @param CarouselInterface $carousel
|
||||
* @return CarouselInterface
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function save(
|
||||
CarouselInterface $carousel
|
||||
);
|
||||
|
||||
/**
|
||||
* Retrieve Carousel
|
||||
* @param string $carouselId
|
||||
* @return CarouselInterface
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function get($carouselId);
|
||||
|
||||
/**
|
||||
* Retrieve Carousel matching the specified criteria.
|
||||
* @param SearchCriteriaInterface $searchCriteria
|
||||
* @return CarouselSearchResultsInterface
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function getList(
|
||||
SearchCriteriaInterface $searchCriteria
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete Carousel
|
||||
* @param CarouselInterface $carousel
|
||||
* @return bool true on success
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function delete(
|
||||
CarouselInterface $carousel
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete Carousel by ID
|
||||
* @param string $carouselId
|
||||
* @return bool true on success
|
||||
* @throws NoSuchEntityException
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function deleteById($carouselId);
|
||||
}
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Api\Data;
|
||||
|
||||
|
||||
use Magento\Framework\Api\ExtensibleDataInterface;
|
||||
|
||||
interface CarouselInterface extends ExtensibleDataInterface
|
||||
{
|
||||
|
||||
const CREATION_TIME = 'creation_time';
|
||||
const UPDATE_TIME = 'update_time';
|
||||
const IDENTIFIER = 'identifier';
|
||||
const TITLE = 'title';
|
||||
const CAROUSEL_ID = 'carousel_id';
|
||||
|
||||
/**
|
||||
* Get carousel_id
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCarouselId();
|
||||
|
||||
/**
|
||||
* Set carousel_id
|
||||
* @param string $carouselId
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setCarouselId($carouselId);
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* @param string $title
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setTitle($title);
|
||||
|
||||
/**
|
||||
* Get identifier
|
||||
* @return string|null
|
||||
*/
|
||||
public function getIdentifier();
|
||||
|
||||
/**
|
||||
* Set identifier
|
||||
* @param string $identifier
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setIdentifier($identifier);
|
||||
|
||||
/**
|
||||
* Get creation_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCreationTime();
|
||||
|
||||
/**
|
||||
* Set creation_time
|
||||
* @param string $creationTime
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setCreationTime($creationTime);
|
||||
|
||||
/**
|
||||
* Get update_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUpdateTime();
|
||||
|
||||
/**
|
||||
* Set update_time
|
||||
* @param string $updateTime
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setUpdateTime($updateTime);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Api\Data;
|
||||
|
||||
|
||||
use Magento\Framework\Api\SearchResultsInterface;
|
||||
|
||||
interface CarouselSearchResultsInterface extends SearchResultsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get Carousel list.
|
||||
* @return CarouselInterface[]
|
||||
*/
|
||||
public function getItems();
|
||||
|
||||
/**
|
||||
* Set title list.
|
||||
* @param CarouselInterface[] $items
|
||||
* @return $this
|
||||
*/
|
||||
public function setItems(array $items);
|
||||
}
|
||||
|
||||
+536
@@ -0,0 +1,536 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Api\Data;
|
||||
|
||||
|
||||
use Magento\Framework\Api\ExtensibleDataInterface;
|
||||
|
||||
interface SlideInterface extends ExtensibleDataInterface
|
||||
{
|
||||
|
||||
const CREATION_TIME = 'creation_time';
|
||||
const UPDATE_TIME = 'update_time';
|
||||
const STORE_ID = 'store_id';
|
||||
const SLIDE_ID = 'slide_id';
|
||||
const CAROUSEL = 'carousel';
|
||||
const IS_ACTIVE = 'is_active';
|
||||
const SORT_ORDER = 'sort_order';
|
||||
const LAYOUT = 'layout';
|
||||
const SLIDE_BG = 'slide_bg';
|
||||
const IMAGE = 'image';
|
||||
const MOBILE_IMAGE = 'mobile_image';
|
||||
const SUBTITLE_COLOR = 'subtitle_color';
|
||||
const TITLE_COLOR = 'title_color';
|
||||
const TITLE_BG = 'title_bg';
|
||||
const TITLE_SIZE = 'title_size';
|
||||
const BUTTON_STYLE = 'button_style';
|
||||
const BUTTON_COLOR = 'button_color';
|
||||
const BUTTON_BG = 'button_bg';
|
||||
const BUTTON_COLOR_HOVER = 'button_color_hover';
|
||||
const BUTTON_BG_HOVER = 'button_bg_hover';
|
||||
const TEXT_COLOR = 'text_color';
|
||||
const SUBTITLE = 'subtitle';
|
||||
const TITLE = 'title';
|
||||
const LINK = 'link';
|
||||
const BUTTON = 'button';
|
||||
const NAV_TITLE = 'nav_title';
|
||||
const CONTENT = 'content';
|
||||
const CONTENT2 = 'content2';
|
||||
const CONTENT_WIDTH = 'content_width';
|
||||
const CONTENT_WRAPPERS = 'content_wrappers';
|
||||
const CUSTOM_CLASS = 'custom_class';
|
||||
const CONTENT_ONLY = 'content_only';
|
||||
const MOBILE_ALIGN = 'mobile_align';
|
||||
const MARGINS = 'margins';
|
||||
const BUTTON_CSS = 'button_css';
|
||||
const SLIDE_LINK = 'slide_link';
|
||||
|
||||
/**
|
||||
* Get slide_id
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSlideId();
|
||||
|
||||
/**
|
||||
* Set slide_id
|
||||
* @param string $slideId
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSlideId($slideId);
|
||||
|
||||
/**
|
||||
* Get carousel
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCarousel();
|
||||
|
||||
/**
|
||||
* Set carousel
|
||||
* @param string $carousel
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setCarousel($carousel);
|
||||
|
||||
/**
|
||||
* Get store_id
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStoreId();
|
||||
|
||||
/**
|
||||
* Set store_id
|
||||
* @param string $storeId
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setStoreId($storeId);
|
||||
|
||||
/**
|
||||
* Get slide_bg
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSlideBg();
|
||||
|
||||
/**
|
||||
* Set slide_bg
|
||||
* @param string $slide_bg
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSlideBg($slide_bg);
|
||||
|
||||
/**
|
||||
* Get image
|
||||
* @return string|null
|
||||
*/
|
||||
public function getImage();
|
||||
|
||||
/**
|
||||
* Set image
|
||||
* @param string $image
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setImage($image);
|
||||
|
||||
/**
|
||||
* Get mobile_image
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMobileImage();
|
||||
|
||||
/**
|
||||
* Set mobile_image
|
||||
* @param string $mobile_image
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setMobileImage($mobile_image);
|
||||
|
||||
/**
|
||||
* Get is_active
|
||||
* @return string|null
|
||||
*/
|
||||
public function getIsActive();
|
||||
|
||||
/**
|
||||
* Set is_active
|
||||
* @param string $isActive
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setIsActive($isActive);
|
||||
|
||||
/**
|
||||
* Get sort_order
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSortOrder();
|
||||
|
||||
/**
|
||||
* Set sort_order
|
||||
* @param string $sortOrder
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSortOrder($sortOrder);
|
||||
|
||||
/**
|
||||
* Get content
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContent();
|
||||
|
||||
/**
|
||||
* Set content
|
||||
* @param string $content
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContent($content);
|
||||
|
||||
/**
|
||||
* Get content2
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContent2();
|
||||
|
||||
/**
|
||||
* Set content2
|
||||
* @param string $content2
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContent2($content2);
|
||||
/**
|
||||
* Get creation_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCreationTime();
|
||||
|
||||
/**
|
||||
* Set creation_time
|
||||
* @param string $creationTime
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setCreationTime($creationTime);
|
||||
|
||||
/**
|
||||
* Get update_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUpdateTime();
|
||||
|
||||
/**
|
||||
* Set update_time
|
||||
* @param string $updateTime
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setUpdateTime($updateTime);
|
||||
|
||||
|
||||
/**
|
||||
* Get layout
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLayout();
|
||||
|
||||
/**
|
||||
* Set layout
|
||||
* @param string $layout
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setLayout($layout);
|
||||
|
||||
/**
|
||||
* Get subtitle_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSubtitleColor();
|
||||
|
||||
/**
|
||||
* Set subtitle_color
|
||||
* @param string $subtitle_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSubtitleColor($subtitle_color);
|
||||
|
||||
/**
|
||||
* Get title_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitleColor();
|
||||
|
||||
/**
|
||||
* Set title_color
|
||||
* @param string $title_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitleColor($title_color);
|
||||
|
||||
/**
|
||||
* Get title_bg
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitleBg();
|
||||
|
||||
/**
|
||||
* Set title_bg
|
||||
* @param string $title_bg
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitleBg($title_bg);
|
||||
|
||||
/**
|
||||
* Get button_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonColor();
|
||||
|
||||
/**
|
||||
* Set button_color
|
||||
* @param string $button_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonColor($button_color);
|
||||
|
||||
/**
|
||||
* Get button_bg
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonBg();
|
||||
|
||||
/**
|
||||
* Set button_bg
|
||||
* @param string $button_bg
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonBg($button_bg);
|
||||
|
||||
/**
|
||||
* Get button_color_hover
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonColorHover();
|
||||
|
||||
/**
|
||||
* Set button_color_hover
|
||||
* @param string $button_color_hover
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonColorHover($button_color_hover);
|
||||
|
||||
/**
|
||||
* Get button_bg_hover
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonBgHover();
|
||||
|
||||
/**
|
||||
* Set button_bg_hover
|
||||
* @param string $button_bg_hover
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonBgHover($button_bg_hover);
|
||||
|
||||
/**
|
||||
* Get text_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTextColor();
|
||||
|
||||
/**
|
||||
* Set text_color
|
||||
* @param string $text_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTextColor($text_color);
|
||||
|
||||
/**
|
||||
* Get subtitle
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSubtitle();
|
||||
|
||||
/**
|
||||
* Set subtitle
|
||||
* @param string $subtitle
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSubtitle($subtitle);
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* @param string $title
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitle($title);
|
||||
|
||||
/**
|
||||
* Get link
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLink();
|
||||
|
||||
/**
|
||||
* Set link
|
||||
* @param string $link
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setLink($link);
|
||||
|
||||
/**
|
||||
* Get button
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButton();
|
||||
|
||||
/**
|
||||
* Set button
|
||||
* @param string $button
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButton($button);
|
||||
|
||||
/**
|
||||
* Get nav_title
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNavTitle();
|
||||
|
||||
/**
|
||||
* Set nav_title
|
||||
* @param string $nav_title
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setNavTitle($nav_title);
|
||||
|
||||
/**
|
||||
* Get title_size
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitleSize();
|
||||
|
||||
/**
|
||||
* Set title_size
|
||||
* @param string $title_size
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitleSize($title_size);
|
||||
|
||||
/**
|
||||
* Get button_style
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonStyle();
|
||||
|
||||
/**
|
||||
* Set button_style
|
||||
* @param string $button_style
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonStyle($button_style);
|
||||
|
||||
/**
|
||||
* Get content_width
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContentWidth();
|
||||
|
||||
/**
|
||||
* Set content_width
|
||||
* @param string $content_width
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContentWidth($content_width);
|
||||
|
||||
/**
|
||||
* Get content_wrappers
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContentWrappers();
|
||||
|
||||
/**
|
||||
* Set content_wrappers
|
||||
* @param string $content_wrappers
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContentWrappers($content_wrappers);
|
||||
|
||||
/**
|
||||
* Get custom_class
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCustomClass();
|
||||
|
||||
/**
|
||||
* Set custom_class
|
||||
* @param string $custom_class
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setCustomClass($custom_class);
|
||||
|
||||
/**
|
||||
* Get content_only
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContentOnly();
|
||||
|
||||
/**
|
||||
* Set content_only
|
||||
* @param string $content_only
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContentOnly($content_only);
|
||||
|
||||
/**
|
||||
* Get mobile_align
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMobileAlign();
|
||||
|
||||
/**
|
||||
* Set mobile_align
|
||||
* @param string $mobile_align
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setMobileAlign($mobile_align);
|
||||
|
||||
/**
|
||||
* Get margins
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMargins();
|
||||
|
||||
/**
|
||||
* Set margins
|
||||
* @param string $margins
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setMargins($margins);
|
||||
|
||||
/**
|
||||
* Get button_css
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonCss();
|
||||
|
||||
/**
|
||||
* Set button_css
|
||||
* @param string $button_css
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonCss($button_css);
|
||||
|
||||
/**
|
||||
* Get slide_link
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSlideLink();
|
||||
|
||||
/**
|
||||
* Set slide_link
|
||||
* @param string $slide_link
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSlideLink($slide_link);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Api\Data;
|
||||
|
||||
|
||||
use Magento\Framework\Api\SearchResultsInterface;
|
||||
|
||||
interface SlideSearchResultsInterface extends SearchResultsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get Slide list.
|
||||
* @return SlideInterface[]
|
||||
*/
|
||||
public function getItems();
|
||||
|
||||
/**
|
||||
* Set carousel list.
|
||||
* @param SlideInterface[] $items
|
||||
* @return $this
|
||||
*/
|
||||
public function setItems(array $items);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Api;
|
||||
|
||||
|
||||
use Magento\Framework\Api\SearchCriteriaInterface;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterface;
|
||||
use Olegnax\Carousel\Api\Data\SlideSearchResultsInterface;
|
||||
|
||||
interface SlideRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Save Slide
|
||||
* @param SlideInterface $slide
|
||||
* @return SlideInterface
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function save(
|
||||
SlideInterface $slide
|
||||
);
|
||||
|
||||
/**
|
||||
* Retrieve Slide
|
||||
* @param string $slideId
|
||||
* @return SlideInterface
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function get($slideId);
|
||||
|
||||
/**
|
||||
* Retrieve Slide matching the specified criteria.
|
||||
* @param SearchCriteriaInterface $searchCriteria
|
||||
* @return SlideSearchResultsInterface
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function getList(
|
||||
SearchCriteriaInterface $searchCriteria
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete Slide
|
||||
* @param SlideInterface $slide
|
||||
* @return bool true on success
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function delete(
|
||||
SlideInterface $slide
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete Slide by ID
|
||||
* @param string $slideId
|
||||
* @return bool true on success
|
||||
* @throws NoSuchEntityException
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function deleteById($slideId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Carousel\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class BackButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [
|
||||
'label' => __('Back'),
|
||||
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
|
||||
'class' => 'back',
|
||||
'sort_order' => 10
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL for back (reset) button
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBackUrl()
|
||||
{
|
||||
return $this->getUrl('*/*/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Carousel\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class DeleteButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
$data = [];
|
||||
if ($this->getModelId()) {
|
||||
$data = [
|
||||
'label' => __('Delete Carousel'),
|
||||
'class' => 'delete',
|
||||
'on_click' => 'deleteConfirm(\'' . __(
|
||||
'Are you sure you want to do this?'
|
||||
) . '\', \'' . $this->getDeleteUrl() . '\')',
|
||||
'sort_order' => 20,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL for delete button
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDeleteUrl()
|
||||
{
|
||||
return $this->getUrl('*/*/delete', ['carousel_id' => $this->getModelId()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Carousel\Edit;
|
||||
|
||||
use Magento\Backend\Block\Widget\Context;
|
||||
|
||||
|
||||
abstract class GenericButton
|
||||
{
|
||||
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
*/
|
||||
public function __construct(Context $context)
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return model ID
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getModelId()
|
||||
{
|
||||
return $this->context->getRequest()->getParam('carousel_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate url by route and parameters
|
||||
*
|
||||
* @param string $route
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl($route = '', $params = [])
|
||||
{
|
||||
return $this->context->getUrlBuilder()->getUrl($route, $params);
|
||||
}
|
||||
}
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Carousel\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class SaveAndContinueButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [
|
||||
'label' => __('Save and Continue Edit'),
|
||||
'class' => 'save',
|
||||
'data_attribute' => [
|
||||
'mage-init' => [
|
||||
'button' => ['event' => 'saveAndContinueEdit'],
|
||||
],
|
||||
],
|
||||
'sort_order' => 80,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Carousel\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class SaveButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [
|
||||
'label' => __('Save Carousel'),
|
||||
'class' => 'save primary',
|
||||
'data_attribute' => [
|
||||
'mage-init' => ['button' => ['event' => 'save']],
|
||||
'form-role' => 'save',
|
||||
],
|
||||
'sort_order' => 90,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Slide\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class BackButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [
|
||||
'label' => __('Back'),
|
||||
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
|
||||
'class' => 'back',
|
||||
'sort_order' => 10
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL for back (reset) button
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBackUrl()
|
||||
{
|
||||
return $this->getUrl('*/*/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Slide\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class DeleteButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
$data = [];
|
||||
if ($this->getModelId()) {
|
||||
$data = [
|
||||
'label' => __('Delete Slide'),
|
||||
'class' => 'delete',
|
||||
'on_click' => 'deleteConfirm(\'' . __(
|
||||
'Are you sure you want to do this?'
|
||||
) . '\', \'' . $this->getDeleteUrl() . '\')',
|
||||
'sort_order' => 20,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL for delete button
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDeleteUrl()
|
||||
{
|
||||
return $this->getUrl('*/*/delete', ['slide_id' => $this->getModelId()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Slide\Edit;
|
||||
|
||||
use Magento\Backend\Block\Widget\Context;
|
||||
|
||||
|
||||
abstract class GenericButton
|
||||
{
|
||||
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
*/
|
||||
public function __construct(Context $context)
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return model ID
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getModelId()
|
||||
{
|
||||
return $this->context->getRequest()->getParam('slide_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate url by route and parameters
|
||||
*
|
||||
* @param string $route
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl($route = '', $params = [])
|
||||
{
|
||||
return $this->context->getUrlBuilder()->getUrl($route, $params);
|
||||
}
|
||||
}
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Slide\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class SaveAndContinueButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [
|
||||
'label' => __('Save and Continue Edit'),
|
||||
'class' => 'save',
|
||||
'data_attribute' => [
|
||||
'mage-init' => [
|
||||
'button' => ['event' => 'saveAndContinueEdit'],
|
||||
],
|
||||
],
|
||||
'sort_order' => 80,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Adminhtml\Slide\Edit;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
|
||||
|
||||
class SaveButton extends GenericButton implements ButtonProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [
|
||||
'label' => __('Save Slide'),
|
||||
'class' => 'save primary',
|
||||
'data_attribute' => [
|
||||
'mage-init' => ['button' => ['event' => 'save']],
|
||||
'form-role' => 'save',
|
||||
],
|
||||
'sort_order' => 90,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Block\Widget;
|
||||
|
||||
use Magento\Customer\Model\Context;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Magento\Framework\Serialize\Serializer\Json;
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Framework\View\Element\Template;
|
||||
use Magento\Widget\Block\BlockInterface;
|
||||
use Olegnax\Carousel\Model\CarouselFactory;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel\CollectionFactory;
|
||||
|
||||
|
||||
class Carousel extends Template implements BlockInterface
|
||||
{
|
||||
|
||||
protected $_template = "widget/carousel.phtml";
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Http\Context
|
||||
*/
|
||||
protected $httpContext;
|
||||
/**
|
||||
* @var Json
|
||||
*/
|
||||
protected $json;
|
||||
/**
|
||||
* @var \Olegnax\Carousel\Model\Carousel
|
||||
*/
|
||||
protected $carouselCollection;
|
||||
|
||||
/**
|
||||
* Carousel constructor.
|
||||
* @param Template\Context $context
|
||||
* @param CarouselFactory $carouselFactory
|
||||
* @param \Magento\Framework\App\Http\Context $httpContext
|
||||
* @param Json $json
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Template\Context $context,
|
||||
CollectionFactory $carouselFactory,
|
||||
\Magento\Framework\App\Http\Context $httpContext,
|
||||
Json $json,
|
||||
array $data = []
|
||||
) {
|
||||
$this->carouselCollection = $carouselFactory->create();
|
||||
$this->httpContext = $httpContext;
|
||||
$this->json = $json;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $newval
|
||||
* @return array
|
||||
* @throws NoSuchEntityException
|
||||
*/
|
||||
public function getCacheKeyInfo($newval = [])
|
||||
{
|
||||
return array_merge([
|
||||
'OLEGNAX_CAROUSEL_WIDGET',
|
||||
$this->_storeManager->getStore()->getId(),
|
||||
$this->_design->getDesignTheme()->getId(),
|
||||
$this->httpContext->getValue(Context::CONTEXT_GROUP),
|
||||
$this->json->serialize($this->getData()),
|
||||
], parent::getCacheKeyInfo(), $newval);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCarouselId()
|
||||
{
|
||||
return 'ox_carousel_' . substr(md5(microtime()), -5);
|
||||
}
|
||||
|
||||
public function getSlide($store_id = null)
|
||||
{
|
||||
$carousel = $this->getCarousel();
|
||||
if ($carousel) {
|
||||
return $this->getCarousel()->getSlide($store_id);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Olegnax\Carousel\Model\Carousel
|
||||
*/
|
||||
public function getCarousel()
|
||||
{
|
||||
$carousel = $this->getData('current_carousel');
|
||||
if (empty($carousel)) {
|
||||
$carousels = $this->carouselCollection
|
||||
->addFieldToSelect('*')
|
||||
->addFieldToFilter('identifier', $this->getData('carousel'));
|
||||
if ($carousels->getSize()) {
|
||||
foreach ($carousels as $carousel) {
|
||||
$this->setData('current_carousel', $carousel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $carousel;
|
||||
}
|
||||
|
||||
protected function _construct()
|
||||
{
|
||||
$this->addData([
|
||||
'cache_lifetime' => 86400,
|
||||
]);
|
||||
if (!$this->hasData('template') && !$this->getTemplate()) {
|
||||
$this->setTemplate('Olegnax_Carousel::widget/carousel.phtml');
|
||||
}
|
||||
parent::_construct();
|
||||
}
|
||||
|
||||
public function getAutoScroll() {
|
||||
$auto_scroll = $this->getData( 'autoplay' );
|
||||
if ( empty( $auto_scroll ) ) {
|
||||
$auto_scroll = 0;
|
||||
}
|
||||
|
||||
return $auto_scroll;
|
||||
}
|
||||
|
||||
public function getResponsive( $to_string = true ) {
|
||||
$responsive = [
|
||||
'0' => [
|
||||
'items' => max(1, (int)$this->getColumnsMobile()),
|
||||
],
|
||||
'768' => [
|
||||
'items' => max(1, (int)$this->getColumnsTablet()),
|
||||
],
|
||||
'1025' => [
|
||||
'items' => max(1, (int)$this->getColumnsDesktopSmall()),
|
||||
],
|
||||
'1160' => [
|
||||
'items' => max(1, (int)$this->getColumnsDesktop()),
|
||||
],
|
||||
];
|
||||
if ( $to_string ) {
|
||||
return json_encode( $responsive );
|
||||
}
|
||||
|
||||
return $responsive;
|
||||
}
|
||||
|
||||
public function prepareStyle( array $style, string $separatorValue = ': ', string $separatorAttribute = ';' ) {
|
||||
$style = array_filter( $style );
|
||||
if ( empty( $style ) ) {
|
||||
return '';
|
||||
}
|
||||
foreach ( $style as $key => &$value ) {
|
||||
$value = $key . $separatorValue . $value;
|
||||
}
|
||||
$style = implode( $separatorAttribute, $style );
|
||||
|
||||
return $style;
|
||||
}
|
||||
public function customStyles( $slider_id, $slide ) {
|
||||
$styles = array();
|
||||
if(!empty($slide)) {
|
||||
if (!empty($slide->getData('subtitle_color'))) { $styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id').' .subtitle{ color:' .$slide->getData('subtitle_color') . '}'; }
|
||||
if (!empty($slide->getData('title_color'))) { $styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id').' .title{ color:' .$slide->getData('title_color') . '}'; }
|
||||
if (!empty($slide->getData('title_bg'))) { $styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' .title{ background-color:' . $slide->getData('title_bg') . '}'; }
|
||||
if (!empty($slide->getData('button_color'))) {
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button{ color:' . $slide->getData('button_color') . '}';
|
||||
}
|
||||
if (!empty($slide->getData('button_color_hover'))) {
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id').' a.ox-slide__button:hover{ color:' .$slide->getData('button_color_hover') . '}';
|
||||
}
|
||||
if (!empty($slide->getData('button_bg_hover'))) {
|
||||
if($slide->getData('button_style') == 'underline'){
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button.underline:hover{ border-color:' . $slide->getData('button_bg_hover') . '}';
|
||||
} elseif($slide->getData('button_style') == 'outline'){
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button.outline:hover{ border-color:' . $slide->getData('button_bg_hover') . '}';
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button:after{ background-color:' . $slide->getData('button_bg_hover') . '}';
|
||||
} else {
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button:after{ background-color:' . $slide->getData('button_bg_hover') . '}';
|
||||
}
|
||||
}
|
||||
if (!empty($slide->getData('button_bg'))) {
|
||||
if($slide->getData('button_style') == 'underline'){
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button.underline{ border-color:' . $slide->getData('button_bg') . '}';
|
||||
} elseif($slide->getData('button_style') == 'outline'){
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button.outline{ border-color:' . $slide->getData('button_bg') . '}';
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button{ background-color:' . $slide->getData('button_bg') . '}';
|
||||
} else {
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' a.ox-slide__button{ background-color:' . $slide->getData('button_bg') . '}';
|
||||
}
|
||||
}
|
||||
if (!empty($slide->getData('content_width'))) {
|
||||
$styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id').'.slide-content-2-col .ox-carousel__col:first-child{' .
|
||||
'max-width:' .$slide->getData('content_width') . 'px;' .
|
||||
'}' .
|
||||
'#' . $slider_id. ' .slide' . $slide->getData('slide_id').' .ox-carousel__inner{ max-width:' .$slide->getData('content_width') . 'px }';
|
||||
}
|
||||
if (!empty($slide->getData('text_color'))) { $styles[] = '#' . $slider_id. ' .slide' . $slide->getData('slide_id') .' .ox-carousel__content{ color:' . $slide->getData('text_color') . '}'; }
|
||||
}
|
||||
if ( !empty($styles) ){
|
||||
return implode(' ', $styles);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
public function getBaseUrl() {
|
||||
$this->_storeManager->getStore()->getBaseUrl( UrlInterface::URL_TYPE_WEB);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\Page;
|
||||
use Magento\Framework\Registry;
|
||||
|
||||
abstract class Carousel extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel';
|
||||
protected $_coreRegistry;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Registry $coreRegistry
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $coreRegistry
|
||||
) {
|
||||
$this->_coreRegistry = $coreRegistry;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init page
|
||||
*
|
||||
* @param Page $resultPage
|
||||
* @return Page
|
||||
*/
|
||||
public function initPage($resultPage)
|
||||
{
|
||||
$resultPage->setActiveMenu(self::ADMIN_RESOURCE)
|
||||
->addBreadcrumb(__('Olegnax'), __('Olegnax'))
|
||||
->addBreadcrumb(__('Carousel'), __('Carousel'));
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Olegnax\Carousel\Model\Carousel;
|
||||
|
||||
class Delete extends \Olegnax\Carousel\Controller\Adminhtml\Carousel
|
||||
{
|
||||
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel_delete';
|
||||
/**
|
||||
* Delete action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
// check if we know what should be deleted
|
||||
$id = $this->getRequest()->getParam('carousel_id');
|
||||
if ($id) {
|
||||
try {
|
||||
// init model and delete
|
||||
$model = $this->_objectManager->create(Carousel::class);
|
||||
$model->load($id);
|
||||
$model->delete();
|
||||
// display success message
|
||||
$this->messageManager->addSuccessMessage(__('You deleted the Carousel.'));
|
||||
// go to grid
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
} catch (Exception $e) {
|
||||
// display error message
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
// go back to edit form
|
||||
return $resultRedirect->setPath('*/*/edit', ['carousel_id' => $id]);
|
||||
}
|
||||
}
|
||||
// display error message
|
||||
$this->messageManager->addErrorMessage(__('We can\'t find a Carousel to delete.'));
|
||||
// go to grid
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\Page;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Olegnax\Carousel\Model\Carousel;
|
||||
|
||||
class Edit extends \Olegnax\Carousel\Controller\Adminhtml\Carousel
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel_view';
|
||||
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Registry $coreRegistry
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $coreRegistry,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
parent::__construct($context, $coreRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
// 1. Get ID and create model
|
||||
$id = $this->getRequest()->getParam('carousel_id');
|
||||
$model = $this->_objectManager->create(Carousel::class);
|
||||
|
||||
// 2. Initial checking
|
||||
if ($id) {
|
||||
$model->load($id);
|
||||
if (!$model->getId()) {
|
||||
$this->messageManager->addErrorMessage(__('This Carousel no longer exists.'));
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
$this->_coreRegistry->register('olegnax_carousel_carousel', $model);
|
||||
|
||||
// 3. Build edit form
|
||||
/** @var Page $resultPage */
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$this->initPage($resultPage)->addBreadcrumb(
|
||||
$id ? __('Edit Carousel') : __('New Carousel'),
|
||||
$id ? __('Edit Carousel') : __('New Carousel')
|
||||
);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Carousels'));
|
||||
$resultPage->getConfig()->getTitle()->prepend($model->getId() ? __('Edit Carousel %1', $model->getId()) : __('New Carousel'));
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class Index extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel';
|
||||
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->getConfig()->getTitle()->prepend(__("Carousel"));
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Controller\Result\Json;
|
||||
use Magento\Framework\Controller\Result\JsonFactory;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Olegnax\Carousel\Model\Carousel;
|
||||
|
||||
class InlineEdit extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel_save';
|
||||
|
||||
protected $jsonFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param JsonFactory $jsonFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
JsonFactory $jsonFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->jsonFactory = $jsonFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline edit action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Json $resultJson */
|
||||
$resultJson = $this->jsonFactory->create();
|
||||
$error = false;
|
||||
$messages = [];
|
||||
|
||||
if ($this->getRequest()->getParam('isAjax')) {
|
||||
$postItems = $this->getRequest()->getParam('items', []);
|
||||
if (!count($postItems)) {
|
||||
$messages[] = __('Please correct the data sent.');
|
||||
$error = true;
|
||||
} else {
|
||||
foreach (array_keys($postItems) as $modelid) {
|
||||
/** @var Carousel $model */
|
||||
$model = $this->_objectManager->create(Carousel::class)->load($modelid);
|
||||
try {
|
||||
$model->setData(array_merge($model->getData(), $postItems[$modelid]));
|
||||
$model->save();
|
||||
} catch (Exception $e) {
|
||||
$messages[] = "[Carousel ID: {$modelid}] {$e->getMessage()}";
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $resultJson->setData([
|
||||
'messages' => $messages,
|
||||
'error' => $error
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\ForwardFactory;
|
||||
use Magento\Framework\Controller\Result\Forward;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\Registry;
|
||||
use Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
class NewAction extends Carousel
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel_save';
|
||||
|
||||
protected $resultForwardFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Registry $coreRegistry
|
||||
* @param ForwardFactory $resultForwardFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $coreRegistry,
|
||||
ForwardFactory $resultForwardFactory
|
||||
) {
|
||||
$this->resultForwardFactory = $resultForwardFactory;
|
||||
parent::__construct($context, $coreRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* New action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Forward $resultForward */
|
||||
$resultForward = $this->resultForwardFactory->create();
|
||||
return $resultForward->forward('edit');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Carousel;
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\App\Request\DataPersistorInterface;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Olegnax\Carousel\Model\Carousel;
|
||||
|
||||
|
||||
class Save extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Carousel_save';
|
||||
|
||||
protected $dataPersistor;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param DataPersistorInterface $dataPersistor
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
DataPersistorInterface $dataPersistor
|
||||
) {
|
||||
$this->dataPersistor = $dataPersistor;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
$data = $this->getRequest()->getPostValue();
|
||||
if ($data) {
|
||||
$id = $this->getRequest()->getParam('carousel_id');
|
||||
|
||||
$model = $this->_objectManager->create(Carousel::class)->load($id);
|
||||
if (!$model->getId() && $id) {
|
||||
$this->messageManager->addErrorMessage(__('This Carousel no longer exists.'));
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
|
||||
$model->setData($data);
|
||||
|
||||
try {
|
||||
$model->save();
|
||||
$this->messageManager->addSuccessMessage(__('You saved the Carousel.'));
|
||||
$this->dataPersistor->clear('olegnax_carousel_carousel');
|
||||
|
||||
if ($this->getRequest()->getParam('back')) {
|
||||
return $resultRedirect->setPath('*/*/edit', ['carousel_id' => $model->getId()]);
|
||||
}
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
} catch (LocalizedException $e) {
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the Carousel.'));
|
||||
}
|
||||
|
||||
$this->dataPersistor->set('olegnax_carousel_carousel', $data);
|
||||
return $resultRedirect->setPath('*/*/edit', ['carousel_id' => $this->getRequest()->getParam('carousel_id')]);
|
||||
}
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\Page;
|
||||
use Magento\Framework\Registry;
|
||||
|
||||
abstract class Slide extends Action
|
||||
{
|
||||
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide';
|
||||
protected $_coreRegistry;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Registry $coreRegistry
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $coreRegistry
|
||||
) {
|
||||
$this->_coreRegistry = $coreRegistry;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init page
|
||||
*
|
||||
* @param Page $resultPage
|
||||
* @return Page
|
||||
*/
|
||||
public function initPage($resultPage)
|
||||
{
|
||||
$resultPage->setActiveMenu(self::ADMIN_RESOURCE)
|
||||
->addBreadcrumb(__('Olegnax'), __('Olegnax'))
|
||||
->addBreadcrumb(__('Slide'), __('Slide'));
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Olegnax\Carousel\Model\Slide;
|
||||
|
||||
class Delete extends \Olegnax\Carousel\Controller\Adminhtml\Slide
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide_delete';
|
||||
/**
|
||||
* Delete action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
// check if we know what should be deleted
|
||||
$id = $this->getRequest()->getParam('slide_id');
|
||||
if ($id) {
|
||||
try {
|
||||
// init model and delete
|
||||
$model = $this->_objectManager->create(Slide::class);
|
||||
$model->load($id);
|
||||
$model->delete();
|
||||
// display success message
|
||||
$this->messageManager->addSuccessMessage(__('You deleted the Slide.'));
|
||||
// go to grid
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
} catch (Exception $e) {
|
||||
// display error message
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
// go back to edit form
|
||||
return $resultRedirect->setPath('*/*/edit', ['slide_id' => $id]);
|
||||
}
|
||||
}
|
||||
// display error message
|
||||
$this->messageManager->addErrorMessage(__('We can\'t find a Slide to delete.'));
|
||||
// go to grid
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\Page;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Olegnax\Carousel\Model\Slide;
|
||||
|
||||
class Edit extends \Olegnax\Carousel\Controller\Adminhtml\Slide
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide_view';
|
||||
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Registry $coreRegistry
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $coreRegistry,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
parent::__construct($context, $coreRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
// 1. Get ID and create model
|
||||
$id = $this->getRequest()->getParam('slide_id');
|
||||
$model = $this->_objectManager->create(Slide::class);
|
||||
|
||||
// 2. Initial checking
|
||||
if ($id) {
|
||||
$model->load($id);
|
||||
if (!$model->getId()) {
|
||||
$this->messageManager->addErrorMessage(__('This Slide no longer exists.'));
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
$this->_coreRegistry->register('olegnax_carousel_slide', $model);
|
||||
|
||||
// 3. Build edit form
|
||||
/** @var Page $resultPage */
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$this->initPage($resultPage)->addBreadcrumb(
|
||||
$id ? __('Edit Slide') : __('New Slide'),
|
||||
$id ? __('Edit Slide') : __('New Slide')
|
||||
);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Slides'));
|
||||
$resultPage->getConfig()->getTitle()->prepend($model->getId() ? __('Edit Slide %1', $model->getId()) : __('New Slide'));
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class Index extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide';
|
||||
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->getConfig()->getTitle()->prepend(__("Slide"));
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Controller\Result\Json;
|
||||
use Magento\Framework\Controller\Result\JsonFactory;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Olegnax\Carousel\Model\Slide;
|
||||
|
||||
class InlineEdit extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide_save';
|
||||
|
||||
protected $jsonFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param JsonFactory $jsonFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
JsonFactory $jsonFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->jsonFactory = $jsonFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline edit action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Json $resultJson */
|
||||
$resultJson = $this->jsonFactory->create();
|
||||
$error = false;
|
||||
$messages = [];
|
||||
|
||||
if ($this->getRequest()->getParam('isAjax')) {
|
||||
$postItems = $this->getRequest()->getParam('items', []);
|
||||
if (!count($postItems)) {
|
||||
$messages[] = __('Please correct the data sent.');
|
||||
$error = true;
|
||||
} else {
|
||||
foreach (array_keys($postItems) as $modelid) {
|
||||
/** @var Slide $model */
|
||||
$model = $this->_objectManager->create(Slide::class)->load($modelid);
|
||||
try {
|
||||
$model->setData(array_merge($model->getData(), $postItems[$modelid]));
|
||||
$model->save();
|
||||
} catch (Exception $e) {
|
||||
$messages[] = "[Slide ID: {$modelid}] {$e->getMessage()}";
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $resultJson->setData([
|
||||
'messages' => $messages,
|
||||
'error' => $error
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\ForwardFactory;
|
||||
use Magento\Framework\Controller\Result\Forward;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\Registry;
|
||||
use Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
class NewAction extends Slide
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide_save';
|
||||
|
||||
protected $resultForwardFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Registry $coreRegistry
|
||||
* @param ForwardFactory $resultForwardFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $coreRegistry,
|
||||
ForwardFactory $resultForwardFactory
|
||||
) {
|
||||
$this->resultForwardFactory = $resultForwardFactory;
|
||||
parent::__construct($context, $coreRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* New action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Forward $resultForward */
|
||||
$resultForward = $this->resultForwardFactory->create();
|
||||
return $resultForward->forward('edit');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Controller\Adminhtml\Slide;
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\App\Request\DataPersistorInterface;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Olegnax\Carousel\Model\Slide;
|
||||
|
||||
|
||||
class Save extends Action
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Carousel::Slide_save';
|
||||
|
||||
protected $dataPersistor;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param DataPersistorInterface $dataPersistor
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
DataPersistorInterface $dataPersistor
|
||||
) {
|
||||
$this->dataPersistor = $dataPersistor;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
$data = $this->getRequest()->getPostValue();
|
||||
if ($data) {
|
||||
$id = $this->getRequest()->getParam('slide_id');
|
||||
|
||||
$model = $this->_objectManager->create(Slide::class)->load($id);
|
||||
if (!$model->getId() && $id) {
|
||||
$this->messageManager->addErrorMessage(__('This Slide no longer exists.'));
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
|
||||
$model->setData($data);
|
||||
|
||||
try {
|
||||
$model->save();
|
||||
$this->messageManager->addSuccessMessage(__('You saved the Slide.'));
|
||||
$this->dataPersistor->clear('olegnax_carousel_slide');
|
||||
|
||||
if ($this->getRequest()->getParam('back')) {
|
||||
return $resultRedirect->setPath('*/*/edit', ['slide_id' => $model->getId()]);
|
||||
}
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
} catch (LocalizedException $e) {
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the Slide.'));
|
||||
}
|
||||
|
||||
$this->dataPersistor->set('olegnax_carousel_slide', $data);
|
||||
return $resultRedirect->setPath('*/*/edit', ['slide_id' => $this->getRequest()->getParam('slide_id')]);
|
||||
}
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Helper;
|
||||
|
||||
use Olegnax\Core\Helper\Helper as CoreHelper;
|
||||
|
||||
class Helper extends CoreHelper
|
||||
{
|
||||
const CONFIG_MODULE = 'ox_carousel';
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+162
@@ -0,0 +1,162 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model;
|
||||
|
||||
use Magento\Framework\Api\DataObjectHelper;
|
||||
use Magento\Framework\Model\AbstractModel;
|
||||
use Magento\Framework\Model\Context;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
use Olegnax\Carousel\Api\Data\CarouselInterface;
|
||||
use Olegnax\Carousel\Api\Data\CarouselInterfaceFactory;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel\Collection;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Slide\CollectionFactory;
|
||||
|
||||
|
||||
class Carousel extends AbstractModel
|
||||
{
|
||||
|
||||
const UPDATE_TIME = 'update_time';
|
||||
protected $_eventPrefix = 'olegnax_carousel_carousel';
|
||||
/**
|
||||
* @var CarouselInterfaceFactory
|
||||
*/
|
||||
protected $carouselDataFactory;
|
||||
|
||||
/**
|
||||
* @var DataObjectHelper
|
||||
*/
|
||||
protected $dataObjectHelper;
|
||||
/**
|
||||
* @var StoreManagerInterface
|
||||
*/
|
||||
protected $_storeManager;
|
||||
/**
|
||||
* @var CollectionFactory
|
||||
*/
|
||||
private $slideFactory;
|
||||
|
||||
/**
|
||||
* Carousel constructor.
|
||||
* @param Context $context
|
||||
* @param Registry $registry
|
||||
* @param CarouselInterfaceFactory $carouselDataFactory
|
||||
* @param DataObjectHelper $dataObjectHelper
|
||||
* @param ResourceModel\Carousel $resource
|
||||
* @param StoreManagerInterface $storeManager
|
||||
* @param CollectionFactory $slideFactory
|
||||
* @param Collection $resourceCollection
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $registry,
|
||||
CarouselInterfaceFactory $carouselDataFactory,
|
||||
DataObjectHelper $dataObjectHelper,
|
||||
ResourceModel\Carousel $resource,
|
||||
StoreManagerInterface $storeManager,
|
||||
CollectionFactory $slideFactory,
|
||||
Collection $resourceCollection,
|
||||
array $data = []
|
||||
) {
|
||||
$this->_storeManager = $storeManager;
|
||||
$this->carouselDataFactory = $carouselDataFactory;
|
||||
$this->slideFactory = $slideFactory;
|
||||
$this->dataObjectHelper = $dataObjectHelper;
|
||||
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve carousel model with carousel data
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function getDataModel()
|
||||
{
|
||||
$carouselData = $this->getData();
|
||||
|
||||
$carouselDataObject = $this->carouselDataFactory->create();
|
||||
$this->dataObjectHelper->populateWithArray(
|
||||
$carouselDataObject,
|
||||
$carouselData,
|
||||
CarouselInterface::class
|
||||
);
|
||||
|
||||
return $carouselDataObject;
|
||||
}
|
||||
|
||||
public function beforeSave()
|
||||
{
|
||||
if ($this->hasDataChanges()) {
|
||||
$this->setUpdateTime(date('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
parent::beforeSave();
|
||||
}
|
||||
|
||||
public function setUpdateTime($updateTime)
|
||||
{
|
||||
return $this->setData(self::UPDATE_TIME, $updateTime);
|
||||
}
|
||||
|
||||
public function getSlide($store_id = null)
|
||||
{
|
||||
return $this->getAllActiveSlide()
|
||||
->addStoreFilter($store_id ? $this->_storeManager->getStore($store_id) : null);
|
||||
}
|
||||
|
||||
public function getAllActiveSlide()
|
||||
{
|
||||
return $this->getAllSlide()
|
||||
->addFieldToFilter('is_active', '1');
|
||||
}
|
||||
|
||||
public function getAllSlide()
|
||||
{
|
||||
return $this->slideFactory->create()->addFieldToSelect('*')
|
||||
->addFieldToFilter('carousel', $this->getData('identifier'))
|
||||
->setOrder('sort_order', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current store id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getStoreId()
|
||||
{
|
||||
return $this->_storeManager->getStore()->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Model construct that should be used for object initialization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init(ResourceModel\Carousel::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\Carousel;
|
||||
|
||||
use Magento\Framework\App\Request\DataPersistorInterface;
|
||||
use Magento\Ui\DataProvider\AbstractDataProvider;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel\CollectionFactory;
|
||||
|
||||
|
||||
class DataProvider extends AbstractDataProvider
|
||||
{
|
||||
|
||||
protected $dataPersistor;
|
||||
|
||||
protected $collection;
|
||||
|
||||
protected $loadedData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $primaryFieldName
|
||||
* @param string $requestFieldName
|
||||
* @param CollectionFactory $collectionFactory
|
||||
* @param DataPersistorInterface $dataPersistor
|
||||
* @param array $meta
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
$name,
|
||||
$primaryFieldName,
|
||||
$requestFieldName,
|
||||
CollectionFactory $collectionFactory,
|
||||
DataPersistorInterface $dataPersistor,
|
||||
array $meta = [],
|
||||
array $data = []
|
||||
) {
|
||||
$this->collection = $collectionFactory->create();
|
||||
$this->dataPersistor = $dataPersistor;
|
||||
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
if (isset($this->loadedData)) {
|
||||
return $this->loadedData;
|
||||
}
|
||||
$items = $this->collection->getItems();
|
||||
foreach ($items as $model) {
|
||||
$this->loadedData[$model->getId()] = $model->getData();
|
||||
}
|
||||
$data = $this->dataPersistor->get('olegnax_carousel_carousel');
|
||||
|
||||
if (!empty($data)) {
|
||||
$model = $this->collection->getNewEmptyItem();
|
||||
$model->setData($data);
|
||||
$this->loadedData[$model->getId()] = $model->getData();
|
||||
$this->dataPersistor->clear('olegnax_carousel_carousel');
|
||||
}
|
||||
|
||||
return $this->loadedData;
|
||||
}
|
||||
}
|
||||
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model;
|
||||
|
||||
use Exception;
|
||||
use Magento\Framework\Api\DataObjectHelper;
|
||||
use Magento\Framework\Api\ExtensibleDataObjectConverter;
|
||||
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
|
||||
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
|
||||
use Magento\Framework\Api\SearchCriteriaInterface;
|
||||
use Magento\Framework\Exception\CouldNotDeleteException;
|
||||
use Magento\Framework\Exception\CouldNotSaveException;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Magento\Framework\Reflection\DataObjectProcessor;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
use Olegnax\Carousel\Api\CarouselRepositoryInterface;
|
||||
use Olegnax\Carousel\Api\Data\CarouselInterface;
|
||||
use Olegnax\Carousel\Api\Data\CarouselInterfaceFactory;
|
||||
use Olegnax\Carousel\Api\Data\CarouselSearchResultsInterfaceFactory;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel as ResourceCarousel;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel\CollectionFactory as CarouselCollectionFactory;
|
||||
|
||||
|
||||
class CarouselRepository implements CarouselRepositoryInterface
|
||||
{
|
||||
|
||||
protected $extensionAttributesJoinProcessor;
|
||||
|
||||
protected $dataCarouselFactory;
|
||||
|
||||
protected $searchResultsFactory;
|
||||
protected $dataObjectProcessor;
|
||||
protected $dataObjectHelper;
|
||||
protected $carouselCollectionFactory;
|
||||
protected $extensibleDataObjectConverter;
|
||||
protected $resource;
|
||||
protected $carouselFactory;
|
||||
private $storeManager;
|
||||
private $collectionProcessor;
|
||||
|
||||
|
||||
/**
|
||||
* @param ResourceCarousel $resource
|
||||
* @param CarouselFactory $carouselFactory
|
||||
* @param CarouselInterfaceFactory $dataCarouselFactory
|
||||
* @param CarouselCollectionFactory $carouselCollectionFactory
|
||||
* @param CarouselSearchResultsInterfaceFactory $searchResultsFactory
|
||||
* @param DataObjectHelper $dataObjectHelper
|
||||
* @param DataObjectProcessor $dataObjectProcessor
|
||||
* @param StoreManagerInterface $storeManager
|
||||
* @param CollectionProcessorInterface $collectionProcessor
|
||||
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
|
||||
* @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
|
||||
*/
|
||||
public function __construct(
|
||||
ResourceCarousel $resource,
|
||||
CarouselFactory $carouselFactory,
|
||||
CarouselInterfaceFactory $dataCarouselFactory,
|
||||
CarouselCollectionFactory $carouselCollectionFactory,
|
||||
CarouselSearchResultsInterfaceFactory $searchResultsFactory,
|
||||
DataObjectHelper $dataObjectHelper,
|
||||
DataObjectProcessor $dataObjectProcessor,
|
||||
StoreManagerInterface $storeManager,
|
||||
CollectionProcessorInterface $collectionProcessor,
|
||||
JoinProcessorInterface $extensionAttributesJoinProcessor,
|
||||
ExtensibleDataObjectConverter $extensibleDataObjectConverter
|
||||
) {
|
||||
$this->resource = $resource;
|
||||
$this->carouselFactory = $carouselFactory;
|
||||
$this->carouselCollectionFactory = $carouselCollectionFactory;
|
||||
$this->searchResultsFactory = $searchResultsFactory;
|
||||
$this->dataObjectHelper = $dataObjectHelper;
|
||||
$this->dataCarouselFactory = $dataCarouselFactory;
|
||||
$this->dataObjectProcessor = $dataObjectProcessor;
|
||||
$this->storeManager = $storeManager;
|
||||
$this->collectionProcessor = $collectionProcessor;
|
||||
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
|
||||
$this->extensibleDataObjectConverter = $extensibleDataObjectConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(
|
||||
CarouselInterface $carousel
|
||||
) {
|
||||
/* if (empty($carousel->getStoreId())) {
|
||||
$storeId = $this->storeManager->getStore()->getId();
|
||||
$carousel->setStoreId($storeId);
|
||||
} */
|
||||
|
||||
$carouselData = $this->extensibleDataObjectConverter->toNestedArray(
|
||||
$carousel,
|
||||
[],
|
||||
CarouselInterface::class
|
||||
);
|
||||
|
||||
$carouselModel = $this->carouselFactory->create()->setData($carouselData);
|
||||
|
||||
try {
|
||||
$this->resource->save($carouselModel);
|
||||
} catch (Exception $exception) {
|
||||
throw new CouldNotSaveException(__(
|
||||
'Could not save the carousel: %1',
|
||||
$exception->getMessage()
|
||||
));
|
||||
}
|
||||
return $carouselModel->getDataModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getList(
|
||||
SearchCriteriaInterface $criteria
|
||||
) {
|
||||
$collection = $this->carouselCollectionFactory->create();
|
||||
|
||||
$this->extensionAttributesJoinProcessor->process(
|
||||
$collection,
|
||||
CarouselInterface::class
|
||||
);
|
||||
|
||||
$this->collectionProcessor->process($criteria, $collection);
|
||||
|
||||
$searchResults = $this->searchResultsFactory->create();
|
||||
$searchResults->setSearchCriteria($criteria);
|
||||
|
||||
$items = [];
|
||||
foreach ($collection as $model) {
|
||||
$items[] = $model->getDataModel();
|
||||
}
|
||||
|
||||
$searchResults->setItems($items);
|
||||
$searchResults->setTotalCount($collection->getSize());
|
||||
return $searchResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteById($carouselId)
|
||||
{
|
||||
return $this->delete($this->get($carouselId));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(
|
||||
CarouselInterface $carousel
|
||||
) {
|
||||
try {
|
||||
$carouselModel = $this->carouselFactory->create();
|
||||
$this->resource->load($carouselModel, $carousel->getCarouselId());
|
||||
$this->resource->delete($carouselModel);
|
||||
} catch (Exception $exception) {
|
||||
throw new CouldNotDeleteException(__(
|
||||
'Could not delete the Carousel: %1',
|
||||
$exception->getMessage()
|
||||
));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($carouselId)
|
||||
{
|
||||
$carousel = $this->carouselFactory->create();
|
||||
$this->resource->load($carousel, $carouselId);
|
||||
if (!$carousel->getId()) {
|
||||
throw new NoSuchEntityException(__('Carousel with id "%1" does not exist.', $carouselId));
|
||||
}
|
||||
return $carousel->getDataModel();
|
||||
}
|
||||
}
|
||||
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\Data;
|
||||
|
||||
use Magento\Framework\Api\AbstractExtensibleObject;
|
||||
use Olegnax\Carousel\Api\Data\CarouselExtensionInterface;
|
||||
use Olegnax\Carousel\Api\Data\CarouselInterface;
|
||||
|
||||
|
||||
class Carousel extends AbstractExtensibleObject implements CarouselInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get carousel_id
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCarouselId()
|
||||
{
|
||||
return $this->_get(self::CAROUSEL_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set carousel_id
|
||||
* @param string $carouselId
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setCarouselId($carouselId)
|
||||
{
|
||||
return $this->setData(self::CAROUSEL_ID, $carouselId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_get(self::TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* @param string $title
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
return $this->setData(self::TITLE, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve existing extension attributes object or create a new one.
|
||||
* @return CarouselExtensionInterface|null
|
||||
*/
|
||||
public function getExtensionAttributes()
|
||||
{
|
||||
return $this->_getExtensionAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an extension attributes object.
|
||||
* @param CarouselExtensionInterface $extensionAttributes
|
||||
* @return $this
|
||||
*/
|
||||
public function setExtensionAttributes(
|
||||
CarouselExtensionInterface $extensionAttributes
|
||||
) {
|
||||
return $this->_setExtensionAttributes($extensionAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier
|
||||
* @return string|null
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->_get(self::IDENTIFIER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set identifier
|
||||
* @param string $identifier
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setIdentifier($identifier)
|
||||
{
|
||||
return $this->setData(self::IDENTIFIER, $identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get creation_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCreationTime()
|
||||
{
|
||||
return $this->_get(self::CREATION_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set creation_time
|
||||
* @param string $creationTime
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setCreationTime($creationTime)
|
||||
{
|
||||
return $this->setData(self::CREATION_TIME, $creationTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get update_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUpdateTime()
|
||||
{
|
||||
return $this->_get(self::UPDATE_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set update_time
|
||||
* @param string $updateTime
|
||||
* @return CarouselInterface
|
||||
*/
|
||||
public function setUpdateTime($updateTime)
|
||||
{
|
||||
return $this->setData(self::UPDATE_TIME, $updateTime);
|
||||
}
|
||||
}
|
||||
|
||||
+735
@@ -0,0 +1,735 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\Data;
|
||||
|
||||
use Magento\Framework\Api\AbstractExtensibleObject;
|
||||
use Olegnax\Carousel\Api\Data\SlideExtensionInterface;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterface;
|
||||
|
||||
|
||||
class Slide extends AbstractExtensibleObject implements SlideInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get slide_id
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSlideId()
|
||||
{
|
||||
return $this->_get(self::SLIDE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slide_id
|
||||
* @param string $slideId
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSlideId($slideId)
|
||||
{
|
||||
return $this->setData(self::SLIDE_ID, $slideId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get carousel
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCarousel()
|
||||
{
|
||||
return $this->_get(self::CAROUSEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set carousel
|
||||
* @param string $carousel
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setCarousel($carousel)
|
||||
{
|
||||
return $this->setData(self::CAROUSEL, $carousel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve existing extension attributes object or create a new one.
|
||||
* @return SlideExtensionInterface|null
|
||||
*/
|
||||
public function getExtensionAttributes()
|
||||
{
|
||||
return $this->_getExtensionAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an extension attributes object.
|
||||
* @param SlideExtensionInterface $extensionAttributes
|
||||
* @return $this
|
||||
*/
|
||||
public function setExtensionAttributes(
|
||||
SlideExtensionInterface $extensionAttributes
|
||||
) {
|
||||
return $this->_setExtensionAttributes($extensionAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get store_id
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStoreId()
|
||||
{
|
||||
return $this->_get(self::STORE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set store_id
|
||||
* @param string $storeId
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setStoreId($storeId)
|
||||
{
|
||||
return $this->setData(self::STORE_ID, $storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slide_bg
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSlideBg()
|
||||
{
|
||||
return $this->_get(self::SLIDE_BG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slide_bg
|
||||
* @param string $slide_bg
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSlideBg($slide_bg)
|
||||
{
|
||||
return $this->setData(self::SLIDE_BG, $slide_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image
|
||||
* @return string|null
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
return $this->_get(self::IMAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image
|
||||
* @param string $image
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setImage($image)
|
||||
{
|
||||
return $this->setData(self::IMAGE, $image);
|
||||
}
|
||||
/**
|
||||
* Get mobile_image
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMobileImage()
|
||||
{
|
||||
return $this->_get(self::MOBILE_IMAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mobile_image
|
||||
* @param string $mobile_image
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setMobileImage($mobile_image)
|
||||
{
|
||||
return $this->setData(self::MOBILE_IMAGE, $mobile_image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get is_active
|
||||
* @return string|null
|
||||
*/
|
||||
public function getIsActive()
|
||||
{
|
||||
return $this->_get(self::IS_ACTIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set is_active
|
||||
* @param string $isActive
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setIsActive($isActive)
|
||||
{
|
||||
return $this->setData(self::IS_ACTIVE, $isActive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sort_order
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSortOrder()
|
||||
{
|
||||
return $this->_get(self::SORT_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sort_order
|
||||
* @param string $sortOrder
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSortOrder($sortOrder)
|
||||
{
|
||||
return $this->setData(self::SORT_ORDER, $sortOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->_get(self::CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content
|
||||
* @param string $content
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
return $this->setData(self::CONTENT, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content2
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContent2()
|
||||
{
|
||||
return $this->_get(self::CONTENT2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content2
|
||||
* @param string $content2
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContent2($content2)
|
||||
{
|
||||
return $this->setData(self::CONTENT2, $content2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get creation_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCreationTime()
|
||||
{
|
||||
return $this->_get(self::CREATION_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set creation_time
|
||||
* @param string $creationTime
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setCreationTime($creationTime)
|
||||
{
|
||||
return $this->setData(self::CREATION_TIME, $creationTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get update_time
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUpdateTime()
|
||||
{
|
||||
return $this->_get(self::UPDATE_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set update_time
|
||||
* @param string $updateTime
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setUpdateTime($updateTime)
|
||||
{
|
||||
return $this->setData(self::UPDATE_TIME, $updateTime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get layout
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLayout()
|
||||
{
|
||||
return $this->_get(self::LAYOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set layout
|
||||
* @param string $layout
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setLayout($layout)
|
||||
{
|
||||
return $this->setData(self::LAYOUT, $layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subtitle_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSubtitleColor()
|
||||
{
|
||||
return $this->_get(self::SUBTITLE_COLOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set subtitle_color
|
||||
* @param string $subtitle_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSubtitleColor($subtitle_color)
|
||||
{
|
||||
return $this->setData(self::SUBTITLE_COLOR, $subtitle_color);
|
||||
}
|
||||
/**
|
||||
* Get title_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitleColor()
|
||||
{
|
||||
return $this->_get(self::TITLE_COLOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title_color
|
||||
* @param string $title_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitleColor($title_color)
|
||||
{
|
||||
return $this->setData(self::TITLE_COLOR, $title_color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title_bg
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitleBg()
|
||||
{
|
||||
return $this->_get(self::TITLE_BG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title_bg
|
||||
* @param string $title_bg
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitleBg($title_bg)
|
||||
{
|
||||
return $this->setData(self::TITLE_BG, $title_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonColor()
|
||||
{
|
||||
return $this->_get(self::BUTTON_COLOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button_color
|
||||
* @param string $button_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonColor($button_color)
|
||||
{
|
||||
return $this->setData(self::BUTTON_COLOR, $button_color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button_bg
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonBg()
|
||||
{
|
||||
return $this->_get(self::BUTTON_BG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button_bg
|
||||
* @param string $button_bg
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonBg($button_bg)
|
||||
{
|
||||
return $this->setData(self::BUTTON_BG, $button_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button_color_hover
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonColorHover()
|
||||
{
|
||||
return $this->_get(self::BUTTON_COLOR_HOVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button_color_hover
|
||||
* @param string $button_color_hover
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonColorHover($button_color_hover)
|
||||
{
|
||||
return $this->setData(self::BUTTON_COLOR_HOVER, $button_color_hover);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button_bg_hover
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonBgHover()
|
||||
{
|
||||
return $this->_get(self::BUTTON_BG_HOVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button_bg_hover
|
||||
* @param string $button_bg_hover
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonBgHover($button_bg_hover)
|
||||
{
|
||||
return $this->setData(self::BUTTON_BG_HOVER, $button_bg_hover);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get text_color
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTextColor()
|
||||
{
|
||||
return $this->_get(self::TEXT_COLOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text_color
|
||||
* @param string $text_color
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTextColor($text_color)
|
||||
{
|
||||
return $this->setData(self::TEXT_COLOR, $text_color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subtitle
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSubtitle()
|
||||
{
|
||||
return $this->_get(self::SUBTITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set subtitle
|
||||
* @param string $subtitle
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSubtitle($subtitle)
|
||||
{
|
||||
return $this->setData(self::SUBTITLE, $subtitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_get(self::TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* @param string $title
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
return $this->setData(self::TITLE, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return $this->_get(self::LINK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set link
|
||||
* @param string $link
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
return $this->setData(self::LINK, $link);
|
||||
}
|
||||
/**
|
||||
* Get button
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButton()
|
||||
{
|
||||
return $this->_get(self::BUTTON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button
|
||||
* @param string $button
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButton($button)
|
||||
{
|
||||
return $this->setData(self::BUTTON, $button);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nav_title
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNavTitle()
|
||||
{
|
||||
return $this->_get(self::NAV_TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set nav_title
|
||||
* @param string $nav_title
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setNavTitle($nav_title)
|
||||
{
|
||||
return $this->setData(self::NAV_TITLE, $nav_title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title_size
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTitleSize()
|
||||
{
|
||||
return $this->_get(self::TITLE_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title_size
|
||||
* @param string $title_size
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setTitleSize($title_size)
|
||||
{
|
||||
return $this->setData(self::TITLE_SIZE, $title_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button_style
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonStyle()
|
||||
{
|
||||
return $this->_get(self::BUTTON_STYLE);
|
||||
}
|
||||
/**
|
||||
* Set button_style
|
||||
* @param string $button_style
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonStyle($button_style)
|
||||
{
|
||||
return $this->setData(self::BUTTON_STYLE, $button_style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content_width
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContentWidth()
|
||||
{
|
||||
return $this->_get(self::CONTENT_WIDTH);
|
||||
}
|
||||
/**
|
||||
* Set content_width
|
||||
* @param string $content_width
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContentWidth($content_width)
|
||||
{
|
||||
return $this->setData(self::CONTENT_WIDTH, $content_width);
|
||||
}
|
||||
/**
|
||||
* Get content_wrappers
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContentWrappers()
|
||||
{
|
||||
return $this->_get(self::CONTENT_WRAPPERS);
|
||||
}
|
||||
/**
|
||||
* Set content_wrappers
|
||||
* @param string $content_wrappers
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContentWrappers($content_wrappers)
|
||||
{
|
||||
return $this->setData(self::CONTENT_WRAPPERS, $content_wrappers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom_class
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCustomClass()
|
||||
{
|
||||
return $this->_get(self::CUSTOM_CLASS);
|
||||
}
|
||||
/**
|
||||
* Set custom_class
|
||||
* @param string $custom_class
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setCustomClass($custom_class)
|
||||
{
|
||||
return $this->setData(self::CUSTOM_CLASS, $custom_class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content_only
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContentOnly()
|
||||
{
|
||||
return $this->_get(self::CONTENT_ONLY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content_only
|
||||
* @param string $content_only
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setContentOnly($content_only)
|
||||
{
|
||||
return $this->setData(self::CONTENT_ONLY, $content_only);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mobile_align
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMobileAlign()
|
||||
{
|
||||
return $this->_get(self::MOBILE_ALIGN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mobile_align
|
||||
* @param string $mobile_align
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setMobileAlign($mobile_align)
|
||||
{
|
||||
return $this->setData(self::MOBILE_ALIGN, $mobile_align);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get margins
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMargins()
|
||||
{
|
||||
return $this->_get(self::MARGINS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set margins
|
||||
* @param string $margins
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setMargins($margins)
|
||||
{
|
||||
return $this->setData(self::MARGINS, $margins);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button_css
|
||||
* @return string|null
|
||||
*/
|
||||
public function getButtonCss()
|
||||
{
|
||||
return $this->_get(self::BUTTON_CSS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button_css
|
||||
* @param string $button_css
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setButtonCss($button_css)
|
||||
{
|
||||
return $this->setData(self::BUTTON_CSS, $button_css);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slide_link
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSlideLink()
|
||||
{
|
||||
return $this->_get(self::SLIDE_LINK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slide_link
|
||||
* @param string $slide_link
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function setSlideLink($slide_link)
|
||||
{
|
||||
return $this->setData(self::SLIDE_LINK, $slide_link);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\ResourceModel;
|
||||
|
||||
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Model\AbstractModel;
|
||||
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
|
||||
|
||||
class Carousel extends AbstractDb
|
||||
{
|
||||
|
||||
/**
|
||||
* Define resource model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init('olegnax_carousel_carousel', 'carousel_id');
|
||||
}
|
||||
|
||||
protected function _beforeSave(AbstractModel $object)
|
||||
{
|
||||
$data = $object->getData('identifier');
|
||||
if (empty($data)) {
|
||||
$data = $object->getData('Title');
|
||||
}
|
||||
$data = str_replace(' ', '_', strtolower($data));
|
||||
$object->setData('identifier', $data);
|
||||
|
||||
if (!$this->getIsUniqueCarousel($object)) {
|
||||
throw new LocalizedException(
|
||||
__('A Carousel identifier with the same properties already exists.')
|
||||
);
|
||||
}
|
||||
|
||||
return parent::_beforeSave($object);
|
||||
}
|
||||
|
||||
private function getIsUniqueCarousel(AbstractModel $object)
|
||||
{
|
||||
$select = $this->getConnection()->select()
|
||||
->from(['cb' => $this->getMainTable()])
|
||||
->where('cb.identifier = ? ', $object->getData('identifier'));
|
||||
|
||||
if ($this->getConnection()->fetchRow($select)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\ResourceModel\Carousel;
|
||||
|
||||
|
||||
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel;
|
||||
|
||||
class Collection extends AbstractCollection
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_idFieldName = 'carousel_id';
|
||||
|
||||
/**
|
||||
* Define resource model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init(
|
||||
\Olegnax\Carousel\Model\Carousel::class,
|
||||
Carousel::class
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\ResourceModel;
|
||||
|
||||
use Magento\Catalog\Model\ImageUploader;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
use Magento\Framework\File\Uploader;
|
||||
use Magento\Framework\Filesystem;
|
||||
use Magento\Framework\Model\AbstractModel;
|
||||
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
|
||||
use Magento\Framework\Model\ResourceModel\Db\Context;
|
||||
use Magento\Framework\Serialize\Serializer\Json;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Slide extends AbstractDb
|
||||
{
|
||||
/**
|
||||
* @var Json
|
||||
*/
|
||||
protected $json;
|
||||
/**
|
||||
* @var ImageUploader
|
||||
*/
|
||||
private $imageUploader;
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
private $_filesystem;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Filesystem $filesystem,
|
||||
Json $json,
|
||||
LoggerInterface $logger,
|
||||
$connectionName = null
|
||||
) {
|
||||
$this->_filesystem = $filesystem;
|
||||
$this->json = $json;
|
||||
$this->_logger = $logger;
|
||||
parent::__construct($context, $connectionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define resource model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init('olegnax_carousel_slide', 'slide_id');
|
||||
}
|
||||
|
||||
protected function _beforeSave(AbstractModel $object)
|
||||
{
|
||||
$data = $object->getData('store_id');
|
||||
if (!empty($data)) {
|
||||
if (is_array($data)) {
|
||||
$data = implode(',', $data);
|
||||
$object->setData('store_id', $data);
|
||||
}
|
||||
} else {
|
||||
$object->setData('store_id', 0);
|
||||
}
|
||||
$this->beforeSaveImage($object, SlideInterface::IMAGE);
|
||||
$this->beforeSaveImage($object, SlideInterface::MOBILE_IMAGE);
|
||||
|
||||
return parent::_beforeSave($object);
|
||||
}
|
||||
|
||||
private function beforeSaveImage($object, $attributeName)
|
||||
{
|
||||
$value = $object->getData($attributeName);
|
||||
|
||||
if ($this->fileResidesOutsideCategoryDir($value)) {
|
||||
// use relative path for image attribute so we know it's outside of category dir when we fetch it
|
||||
// phpcs:ignore Magento2.Functions.DiscouragedFunction
|
||||
$value[0]['url'] = parse_url($value[0]['url'], PHP_URL_PATH);
|
||||
$value[0]['name'] = $value[0]['url'];
|
||||
}
|
||||
|
||||
if ($imageName = $this->getUploadedImageName($value)) {
|
||||
if (!$this->fileResidesOutsideCategoryDir($value)) {
|
||||
$imageName = $this->checkUniqueImageName($imageName);
|
||||
}
|
||||
$object->setData($attributeName, $imageName);
|
||||
} elseif (!is_string($value)) {
|
||||
$object->setData($attributeName, null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for file path resides outside of category media dir. The URL will be a path including pub/media if true
|
||||
*
|
||||
* @param array|null $value
|
||||
* @return bool
|
||||
*/
|
||||
private function fileResidesOutsideCategoryDir($value)
|
||||
{
|
||||
if (!is_array($value) || !isset($value[0]['url'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fileUrl = ltrim((string)$value[0]['url'], '/');
|
||||
$baseMediaDir = $this->_filesystem->getUri(DirectoryList::MEDIA);
|
||||
|
||||
if (!$baseMediaDir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return strpos($fileUrl, $baseMediaDir) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets image name from $value array.
|
||||
*
|
||||
* Will return empty string in a case when $value is not an array.
|
||||
*
|
||||
* @param array $value Attribute value
|
||||
* @return string
|
||||
*/
|
||||
private function getUploadedImageName($value)
|
||||
{
|
||||
if (is_array($value) && isset($value[0]['name'])) {
|
||||
return $value[0]['name'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that image name exists in catalog/category directory and return new image name if it already exists.
|
||||
*
|
||||
* @param string $imageName
|
||||
* @return string
|
||||
*/
|
||||
private function checkUniqueImageName(string $imageName): string
|
||||
{
|
||||
$imageUploader = $this->getImageUploader();
|
||||
$mediaDirectory = $this->_filesystem->getDirectoryWrite(DirectoryList::MEDIA);
|
||||
$imageAbsolutePath = $mediaDirectory->getAbsolutePath(
|
||||
$imageUploader->getBasePath() . DIRECTORY_SEPARATOR . $imageName
|
||||
);
|
||||
|
||||
$imageName = Uploader::getNewFilename($imageAbsolutePath);
|
||||
|
||||
return $imageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Instance of Category Image Uploader.
|
||||
*
|
||||
* @return ImageUploader
|
||||
*
|
||||
* @deprecated 101.0.0
|
||||
*/
|
||||
private function getImageUploader()
|
||||
{
|
||||
if ($this->imageUploader === null) {
|
||||
$this->imageUploader = ObjectManager::getInstance()
|
||||
->get(ImageUploader::class);
|
||||
}
|
||||
|
||||
return $this->imageUploader;
|
||||
}
|
||||
|
||||
protected function _afterLoad(AbstractModel $object)
|
||||
{
|
||||
$data = $object->getData('store_id');
|
||||
if (!empty($data) && !is_array($data)) {
|
||||
$data = explode(',', $data);
|
||||
$object->setData('store_id', $data);
|
||||
}
|
||||
return parent::_afterLoad($object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\ResourceModel\Slide;
|
||||
|
||||
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface;
|
||||
use Magento\Framework\Data\Collection\EntityFactoryInterface;
|
||||
use Magento\Framework\DB\Adapter\AdapterInterface;
|
||||
use Magento\Framework\Event\ManagerInterface;
|
||||
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
|
||||
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
|
||||
use Magento\Store\Api\Data\StoreInterface;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Slide;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Collection extends AbstractCollection
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_idFieldName = 'slide_id';
|
||||
/**
|
||||
* @var StoreManagerInterface
|
||||
*/
|
||||
protected $_storeManager;
|
||||
private $_storeId;
|
||||
|
||||
public function __construct(
|
||||
EntityFactoryInterface $entityFactory,
|
||||
LoggerInterface $logger,
|
||||
FetchStrategyInterface $fetchStrategy,
|
||||
ManagerInterface $eventManager,
|
||||
StoreManagerInterface $storeManager,
|
||||
AdapterInterface $connection = null,
|
||||
AbstractDb $resource = null
|
||||
) {
|
||||
$this->_storeManager = $storeManager;
|
||||
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add store availability filter. Include availability product
|
||||
* for store website
|
||||
*
|
||||
* @param null|string|bool|int $store
|
||||
* @return \Olegnax\Carousel\Model\ResourceModel\Slide\Collection
|
||||
*/
|
||||
public function addStoreFilter($store = null)
|
||||
{
|
||||
if ($store === null) {
|
||||
$store = $this->getStoreId();
|
||||
}
|
||||
$store = $this->_storeManager->getStore($store);
|
||||
|
||||
$this->getSelect()->where("(`store_id` = 0 OR `store_id` LIKE '?,%' OR `store_id` = ? OR `store_id` LIKE '%,?' OR `store_id` LIKE '%,?,%')", $store->getId(), 'int');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current store id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStoreId()
|
||||
{
|
||||
if ($this->_storeId === null) {
|
||||
$this->setStoreId($this->_storeManager->getStore()->getId());
|
||||
}
|
||||
return $this->_storeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set store scope
|
||||
*
|
||||
* @param int|string|StoreInterface $storeId
|
||||
* @return $this
|
||||
*/
|
||||
public function setStoreId($storeId)
|
||||
{
|
||||
if ($storeId instanceof StoreInterface) {
|
||||
$storeId = $storeId->getId();
|
||||
}
|
||||
$this->_storeId = (int)$storeId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define resource model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init(
|
||||
\Olegnax\Carousel\Model\Slide::class,
|
||||
Slide::class
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Executable
+238
@@ -0,0 +1,238 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model;
|
||||
|
||||
use Magento\Catalog\Model\Category\FileInfo;
|
||||
use Magento\Cms\Model\Template\FilterProvider;
|
||||
use Magento\Framework\Api\DataObjectHelper;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Filesystem\DirectoryList;
|
||||
use Magento\Framework\Filter\Template;
|
||||
use Magento\Framework\Model\AbstractModel;
|
||||
use Magento\Framework\Model\Context;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterface;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterfaceFactory;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Slide\Collection;
|
||||
|
||||
|
||||
class Slide extends AbstractModel
|
||||
{
|
||||
|
||||
const UPDATE_TIME = 'update_time';
|
||||
protected $slideDataFactory;
|
||||
|
||||
protected $_eventPrefix = 'olegnax_carousel_slide';
|
||||
protected $dataObjectHelper;
|
||||
/**
|
||||
* @var StoreManagerInterface
|
||||
*/
|
||||
protected $_storeManager;
|
||||
/**
|
||||
* @var DirectoryList
|
||||
*/
|
||||
protected $directoryList;
|
||||
/**
|
||||
* @var FilterProvider
|
||||
*/
|
||||
protected $filterProvider;
|
||||
|
||||
/**
|
||||
* Slide constructor.
|
||||
* @param Context $context
|
||||
* @param Registry $registry
|
||||
* @param SlideInterfaceFactory $slideDataFactory
|
||||
* @param DataObjectHelper $dataObjectHelper
|
||||
* @param ResourceModel\Slide $resource
|
||||
* @param Collection $resourceCollection
|
||||
* @param StoreManagerInterface $storeManager
|
||||
* @param DirectoryList $directoryList
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $registry,
|
||||
SlideInterfaceFactory $slideDataFactory,
|
||||
DataObjectHelper $dataObjectHelper,
|
||||
ResourceModel\Slide $resource,
|
||||
Collection $resourceCollection,
|
||||
StoreManagerInterface $storeManager,
|
||||
DirectoryList $directoryList,
|
||||
FilterProvider $filterProvider,
|
||||
array $data = []
|
||||
) {
|
||||
$this->slideDataFactory = $slideDataFactory;
|
||||
$this->dataObjectHelper = $dataObjectHelper;
|
||||
$this->_storeManager = $storeManager;
|
||||
$this->directoryList = $directoryList;
|
||||
$this->filterProvider = $filterProvider;
|
||||
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve slide model with slide data
|
||||
* @return SlideInterface
|
||||
*/
|
||||
public function getDataModel()
|
||||
{
|
||||
$slideData = $this->getData();
|
||||
|
||||
$slideDataObject = $this->slideDataFactory->create();
|
||||
$this->dataObjectHelper->populateWithArray(
|
||||
$slideDataObject,
|
||||
$slideData,
|
||||
SlideInterface::class
|
||||
);
|
||||
|
||||
return $slideDataObject;
|
||||
}
|
||||
|
||||
public function getIdentities()
|
||||
{
|
||||
return [$this->_eventPrefix . '_' . $this->getId()];
|
||||
}
|
||||
|
||||
public function beforeSave()
|
||||
{
|
||||
if ($this->hasDataChanges()) {
|
||||
$this->setUpdateTime(date('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
parent::beforeSave();
|
||||
}
|
||||
|
||||
public function setUpdateTime($updateTime)
|
||||
{
|
||||
return $this->setData(self::UPDATE_TIME, $updateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns image url
|
||||
*
|
||||
* @param string $attributeCode
|
||||
* @return bool|string
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function getImageUrl($attributeCode = 'image')
|
||||
{
|
||||
$url = false;
|
||||
$image = $this->getData($attributeCode);
|
||||
if ($image) {
|
||||
if (is_string($image)) {
|
||||
$store = $this->_storeManager->getStore();
|
||||
$baseUrl = $store->getBaseUrl();
|
||||
$baseUrl = str_replace(parse_url($baseUrl, PHP_URL_PATH), '/', $baseUrl);
|
||||
$url = $baseUrl . ltrim($image, '/');
|
||||
} else {
|
||||
throw new LocalizedException(
|
||||
__('Something went wrong while getting the image url.')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function hasImage($fieldId = 'image')
|
||||
{
|
||||
return ((bool)$this->getData($fieldId) !== false && $this->existsImage($fieldId));
|
||||
}
|
||||
|
||||
public function existsImage($fieldId = 'image')
|
||||
{
|
||||
$fullPath = $this->getAbsoluteImagePath($fieldId);
|
||||
return $fullPath
|
||||
&& file_exists($fullPath)
|
||||
&& is_file($fullPath);
|
||||
}
|
||||
|
||||
public function getAbsoluteImagePath($fieldId = 'image')
|
||||
{
|
||||
return $this->getPrefixedPath(
|
||||
$this->getData($fieldId),
|
||||
$this->directoryList->getPath("media")
|
||||
);
|
||||
}
|
||||
|
||||
private function getPrefixedPath($path, $prefix = '')
|
||||
{
|
||||
$fullPath = '';
|
||||
if (!empty($path)) {
|
||||
$path = preg_replace('#^/pub#i', '', $path);
|
||||
$path = preg_replace('#^/media#i', '', $path);
|
||||
if (preg_match('#/$#', $prefix)) {
|
||||
$path = ltrim($path, '/');
|
||||
}
|
||||
$fullPath = $prefix . $path;
|
||||
}
|
||||
return $fullPath;
|
||||
}
|
||||
|
||||
public function getContent($store_id = null)
|
||||
{
|
||||
$content = $this->getData('content');
|
||||
if (empty($content)) {
|
||||
$content = '';
|
||||
}
|
||||
$content = trim($content);
|
||||
/** @var Template $filter */
|
||||
$filter = $this->filterProvider->getBlockFilter();
|
||||
if (!empty($store_id)) {
|
||||
$filter = $filter->setStoreId($store_id);
|
||||
}
|
||||
$content = $filter->filter($content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function getContent2($store_id = null)
|
||||
{
|
||||
$content = $this->getData('content2');
|
||||
if (empty($content)) {
|
||||
$content = '';
|
||||
}
|
||||
$content = trim($content);
|
||||
/** @var Template $filter */
|
||||
$filter = $this->filterProvider->getBlockFilter();
|
||||
if (!empty($store_id)) {
|
||||
$filter = $filter->setStoreId($store_id);
|
||||
}
|
||||
$content = $filter->filter($content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Model construct that should be used for object initialization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init(ResourceModel\Slide::class);
|
||||
}
|
||||
}
|
||||
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide;
|
||||
|
||||
use Magento\Catalog\Model\Category\FileInfo;
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
use Magento\Framework\App\Request\DataPersistorInterface;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Ui\DataProvider\AbstractDataProvider;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterface;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Slide\CollectionFactory;
|
||||
use Olegnax\Carousel\Model\Slide;
|
||||
|
||||
|
||||
class DataProvider extends AbstractDataProvider
|
||||
{
|
||||
|
||||
protected $dataPersistor;
|
||||
|
||||
protected $collection;
|
||||
|
||||
protected $loadedData;
|
||||
protected $fileInfo;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $primaryFieldName
|
||||
* @param string $requestFieldName
|
||||
* @param CollectionFactory $collectionFactory
|
||||
* @param DataPersistorInterface $dataPersistor
|
||||
* @param array $meta
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
$name,
|
||||
$primaryFieldName,
|
||||
$requestFieldName,
|
||||
CollectionFactory $collectionFactory,
|
||||
DataPersistorInterface $dataPersistor,
|
||||
array $meta = [],
|
||||
array $data = []
|
||||
) {
|
||||
$this->collection = $collectionFactory->create();
|
||||
$this->dataPersistor = $dataPersistor;
|
||||
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
if (isset($this->loadedData)) {
|
||||
return $this->loadedData;
|
||||
}
|
||||
$items = $this->collection->getItems();
|
||||
foreach ($items as $model) {
|
||||
$data = $model->getData();
|
||||
$data = $this->convertValues($data, $model);
|
||||
$this->loadedData[$model->getId()] = $data;
|
||||
}
|
||||
$data = $this->dataPersistor->get('olegnax_carousel_slide');
|
||||
|
||||
if (!empty($data)) {
|
||||
$model = $this->collection->getNewEmptyItem();
|
||||
$model->setData($data);
|
||||
$this->loadedData[$model->getId()] = $model->getData();
|
||||
$this->dataPersistor->clear('olegnax_carousel_slide');
|
||||
}
|
||||
|
||||
return $this->loadedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Slide $model
|
||||
* @return mixed
|
||||
*/
|
||||
protected function convertValues($data, $model)
|
||||
{
|
||||
$data = $this->convertImage($data, $model, SlideInterface::IMAGE);
|
||||
$data = $this->convertImage($data, $model, SlideInterface::MOBILE_IMAGE);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Slide $model
|
||||
* @param string $attributeCode
|
||||
* @return mixed
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
private function convertImage($data, $model, $attributeCode){
|
||||
if (isset($data[$attributeCode]) && !empty($data[$attributeCode])) {
|
||||
unset($data[$attributeCode]);
|
||||
$fileName = $model->getData($attributeCode);
|
||||
$fileInfo = $this->getFileInfo();
|
||||
if ($fileInfo->isExist($fileName)) {
|
||||
$stat = $fileInfo->getStat($fileName);
|
||||
$mime = $fileInfo->getMimeType($fileName);
|
||||
|
||||
// phpcs:ignore Magento2.Functions.DiscouragedFunction
|
||||
$data[$attributeCode][0]['name'] = basename($fileName);
|
||||
|
||||
if ($fileInfo->isBeginsWithMediaDirectoryPath($fileName)) {
|
||||
$data[$attributeCode][0]['url'] = $fileName;
|
||||
} else {
|
||||
$data[$attributeCode][0]['url'] = $model->getImageUrl($attributeCode);
|
||||
}
|
||||
|
||||
$data[$attributeCode][0]['size'] = isset($stat) ? $stat['size'] : 0;
|
||||
$data[$attributeCode][0]['type'] = $mime;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get FileInfo instance
|
||||
*
|
||||
* @return FileInfo
|
||||
*
|
||||
* @deprecated 102.0.0
|
||||
*/
|
||||
private function getFileInfo(): FileInfo
|
||||
{
|
||||
if ($this->fileInfo === null) {
|
||||
$this->fileInfo = ObjectManager::getInstance()->get(FileInfo::class);
|
||||
}
|
||||
return $this->fileInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class ButtonStyle implements ArrayInterface
|
||||
{
|
||||
|
||||
public function toOptionArray() {
|
||||
return [
|
||||
[
|
||||
'value' => '',
|
||||
'label' => __('Theme')
|
||||
],
|
||||
[
|
||||
'value' => 'simple',
|
||||
'label' => __('Simple')
|
||||
],
|
||||
[
|
||||
'value' => 'naked',
|
||||
'label' => __('Naked')
|
||||
],
|
||||
[
|
||||
'value' => 'outline',
|
||||
'label' => __('OutLine')
|
||||
],
|
||||
[
|
||||
'value' => 'underline',
|
||||
'label' => __('Underlined')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Data\Collection;
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel\CollectionFactory;
|
||||
|
||||
class Carousel implements ArrayInterface
|
||||
{
|
||||
|
||||
protected $collection;
|
||||
|
||||
public function __construct(
|
||||
CollectionFactory $collection
|
||||
) {
|
||||
$this->collection = $collection->create()->addFieldToSelect('*')->setOrder('title', Collection::SORT_ORDER_ASC);
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
$array = [];
|
||||
foreach ($this->toOptionArray() as $item) {
|
||||
$array[$item['value']] = $item['label'];
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function toOptionArray()
|
||||
{
|
||||
|
||||
$options = [];
|
||||
foreach ($this->collection as $carousel) {
|
||||
$options[] = [
|
||||
'value' => $carousel->getIdentifier(),
|
||||
'label' => $carousel->getTitle()
|
||||
];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class Layout implements ArrayInterface
|
||||
{
|
||||
|
||||
public function toOptionArray() {
|
||||
return [
|
||||
[
|
||||
'value' => 'left',
|
||||
'label' => __('Left')
|
||||
],
|
||||
[
|
||||
'value' => 'right',
|
||||
'label' => __('Right')
|
||||
],
|
||||
[
|
||||
'value' => 'center',
|
||||
'label' => __('Center')
|
||||
],
|
||||
[
|
||||
'value' => '2-col',
|
||||
'label' => __('2 Columns')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class Margins implements ArrayInterface
|
||||
{
|
||||
|
||||
public function toOptionArray() {
|
||||
return [
|
||||
[
|
||||
'value' => 'normal',
|
||||
'label' => __('Normal')
|
||||
],
|
||||
[
|
||||
'value' => 'big',
|
||||
'label' => __('Big')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class MobileAlign implements ArrayInterface
|
||||
{
|
||||
|
||||
public function toOptionArray() {
|
||||
return [
|
||||
[
|
||||
'value' => 'left',
|
||||
'label' => __('Left')
|
||||
],
|
||||
[
|
||||
'value' => 'right',
|
||||
'label' => __('Right')
|
||||
],
|
||||
[
|
||||
'value' => 'center',
|
||||
'label' => __('Center')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class TitleSize implements ArrayInterface
|
||||
{
|
||||
|
||||
public function toOptionArray() {
|
||||
return [
|
||||
[
|
||||
'value' => '',
|
||||
'label' => __('Normal')
|
||||
],
|
||||
[
|
||||
'value' => 'big',
|
||||
'label' => __('Medium')
|
||||
],
|
||||
[
|
||||
'value' => 'huge',
|
||||
'label' => __('Big')
|
||||
],
|
||||
[
|
||||
'value' => 'huge-6vw',
|
||||
'label' => __('Huge')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\Carousel\Model\Slide\Source;
|
||||
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class Wrappers implements ArrayInterface
|
||||
{
|
||||
|
||||
public function toOptionArray() {
|
||||
return [
|
||||
[
|
||||
'value' => 'container',
|
||||
'label' => __('Container')
|
||||
],
|
||||
[
|
||||
'value' => 'no-container',
|
||||
'label' => __('No Container')
|
||||
],
|
||||
[
|
||||
'value' => 'raw',
|
||||
'label' => __('Raw')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Model;
|
||||
|
||||
use Exception;
|
||||
use Magento\Framework\Api\DataObjectHelper;
|
||||
use Magento\Framework\Api\ExtensibleDataObjectConverter;
|
||||
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
|
||||
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
|
||||
use Magento\Framework\Api\SearchCriteriaInterface;
|
||||
use Magento\Framework\Exception\CouldNotDeleteException;
|
||||
use Magento\Framework\Exception\CouldNotSaveException;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Magento\Framework\Reflection\DataObjectProcessor;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterface;
|
||||
use Olegnax\Carousel\Api\Data\SlideInterfaceFactory;
|
||||
use Olegnax\Carousel\Api\Data\SlideSearchResultsInterfaceFactory;
|
||||
use Olegnax\Carousel\Api\SlideRepositoryInterface;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Slide as ResourceSlide;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Slide\CollectionFactory as SlideCollectionFactory;
|
||||
|
||||
|
||||
class SlideRepository implements SlideRepositoryInterface
|
||||
{
|
||||
|
||||
protected $extensionAttributesJoinProcessor;
|
||||
|
||||
protected $dataSlideFactory;
|
||||
|
||||
protected $searchResultsFactory;
|
||||
protected $dataObjectProcessor;
|
||||
protected $dataObjectHelper;
|
||||
protected $extensibleDataObjectConverter;
|
||||
protected $slideCollectionFactory;
|
||||
protected $resource;
|
||||
protected $slideFactory;
|
||||
private $storeManager;
|
||||
private $collectionProcessor;
|
||||
|
||||
/**
|
||||
* @param ResourceSlide $resource
|
||||
* @param SlideFactory $slideFactory
|
||||
* @param SlideInterfaceFactory $dataSlideFactory
|
||||
* @param SlideCollectionFactory $slideCollectionFactory
|
||||
* @param SlideSearchResultsInterfaceFactory $searchResultsFactory
|
||||
* @param DataObjectHelper $dataObjectHelper
|
||||
* @param DataObjectProcessor $dataObjectProcessor
|
||||
* @param StoreManagerInterface $storeManager
|
||||
* @param CollectionProcessorInterface $collectionProcessor
|
||||
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
|
||||
* @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
|
||||
*/
|
||||
public function __construct(
|
||||
ResourceSlide $resource,
|
||||
SlideFactory $slideFactory,
|
||||
SlideInterfaceFactory $dataSlideFactory,
|
||||
SlideCollectionFactory $slideCollectionFactory,
|
||||
SlideSearchResultsInterfaceFactory $searchResultsFactory,
|
||||
DataObjectHelper $dataObjectHelper,
|
||||
DataObjectProcessor $dataObjectProcessor,
|
||||
StoreManagerInterface $storeManager,
|
||||
CollectionProcessorInterface $collectionProcessor,
|
||||
JoinProcessorInterface $extensionAttributesJoinProcessor,
|
||||
ExtensibleDataObjectConverter $extensibleDataObjectConverter
|
||||
) {
|
||||
$this->resource = $resource;
|
||||
$this->slideFactory = $slideFactory;
|
||||
$this->slideCollectionFactory = $slideCollectionFactory;
|
||||
$this->searchResultsFactory = $searchResultsFactory;
|
||||
$this->dataObjectHelper = $dataObjectHelper;
|
||||
$this->dataSlideFactory = $dataSlideFactory;
|
||||
$this->dataObjectProcessor = $dataObjectProcessor;
|
||||
$this->storeManager = $storeManager;
|
||||
$this->collectionProcessor = $collectionProcessor;
|
||||
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
|
||||
$this->extensibleDataObjectConverter = $extensibleDataObjectConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(
|
||||
SlideInterface $slide
|
||||
) {
|
||||
/* if (empty($slide->getStoreId())) {
|
||||
$storeId = $this->storeManager->getStore()->getId();
|
||||
$slide->setStoreId($storeId);
|
||||
} */
|
||||
|
||||
$slideData = $this->extensibleDataObjectConverter->toNestedArray(
|
||||
$slide,
|
||||
[],
|
||||
SlideInterface::class
|
||||
);
|
||||
|
||||
$slideModel = $this->slideFactory->create()->setData($slideData);
|
||||
|
||||
try {
|
||||
$this->resource->save($slideModel);
|
||||
} catch (Exception $exception) {
|
||||
throw new CouldNotSaveException(__(
|
||||
'Could not save the slide: %1',
|
||||
$exception->getMessage()
|
||||
));
|
||||
}
|
||||
return $slideModel->getDataModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getList(
|
||||
SearchCriteriaInterface $criteria
|
||||
) {
|
||||
$collection = $this->slideCollectionFactory->create();
|
||||
|
||||
$this->extensionAttributesJoinProcessor->process(
|
||||
$collection,
|
||||
SlideInterface::class
|
||||
);
|
||||
|
||||
$this->collectionProcessor->process($criteria, $collection);
|
||||
|
||||
$searchResults = $this->searchResultsFactory->create();
|
||||
$searchResults->setSearchCriteria($criteria);
|
||||
|
||||
$items = [];
|
||||
foreach ($collection as $model) {
|
||||
$items[] = $model->getDataModel();
|
||||
}
|
||||
|
||||
$searchResults->setItems($items);
|
||||
$searchResults->setTotalCount($collection->getSize());
|
||||
return $searchResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteById($slideId)
|
||||
{
|
||||
return $this->delete($this->get($slideId));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(
|
||||
SlideInterface $slide
|
||||
) {
|
||||
try {
|
||||
$slideModel = $this->slideFactory->create();
|
||||
$this->resource->load($slideModel, $slide->getSlideId());
|
||||
$this->resource->delete($slideModel);
|
||||
} catch (Exception $exception) {
|
||||
throw new CouldNotDeleteException(__(
|
||||
'Could not delete the Slide: %1',
|
||||
$exception->getMessage()
|
||||
));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($slideId)
|
||||
{
|
||||
$slide = $this->slideFactory->create();
|
||||
$this->resource->load($slide, $slideId);
|
||||
if (!$slide->getId()) {
|
||||
throw new NoSuchEntityException(__('Slide with id "%1" does not exist.', $slideId));
|
||||
}
|
||||
return $slide->getDataModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Ui\Component\Listing\Column;
|
||||
|
||||
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Framework\View\Element\UiComponent\ContextInterface;
|
||||
use Magento\Framework\View\Element\UiComponentFactory;
|
||||
use Magento\Ui\Component\Listing\Columns\Column;
|
||||
|
||||
class CarouselActions extends Column
|
||||
{
|
||||
|
||||
const URL_PATH_DETAILS = 'olegnax_carousel/carousel/details';
|
||||
const URL_PATH_EDIT = 'olegnax_carousel/carousel/edit';
|
||||
const URL_PATH_DELETE = 'olegnax_carousel/carousel/delete';
|
||||
protected $urlBuilder;
|
||||
|
||||
/**
|
||||
* @param ContextInterface $context
|
||||
* @param UiComponentFactory $uiComponentFactory
|
||||
* @param UrlInterface $urlBuilder
|
||||
* @param array $components
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
ContextInterface $context,
|
||||
UiComponentFactory $uiComponentFactory,
|
||||
UrlInterface $urlBuilder,
|
||||
array $components = [],
|
||||
array $data = []
|
||||
) {
|
||||
$this->urlBuilder = $urlBuilder;
|
||||
parent::__construct($context, $uiComponentFactory, $components, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Data Source
|
||||
*
|
||||
* @param array $dataSource
|
||||
* @return array
|
||||
*/
|
||||
public function prepareDataSource(array $dataSource)
|
||||
{
|
||||
if (isset($dataSource['data']['items'])) {
|
||||
foreach ($dataSource['data']['items'] as & $item) {
|
||||
if (isset($item['carousel_id'])) {
|
||||
$item[$this->getData('name')] = [
|
||||
'edit' => [
|
||||
'href' => $this->urlBuilder->getUrl(
|
||||
static::URL_PATH_EDIT,
|
||||
[
|
||||
'carousel_id' => $item['carousel_id']
|
||||
]
|
||||
),
|
||||
'label' => __('Edit')
|
||||
],
|
||||
'delete' => [
|
||||
'href' => $this->urlBuilder->getUrl(
|
||||
static::URL_PATH_DELETE,
|
||||
[
|
||||
'carousel_id' => $item['carousel_id']
|
||||
]
|
||||
),
|
||||
'label' => __('Delete'),
|
||||
'confirm' => [
|
||||
'title' => __('Delete "%1"', $item['title']),
|
||||
'message' => __('Are you sure you wan\'t to delete a "%1" record?', $item['title'])
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dataSource;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Olegnax\Carousel\Ui\Component\Listing\Column;
|
||||
|
||||
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Framework\View\Element\UiComponent\ContextInterface;
|
||||
use Magento\Framework\View\Element\UiComponentFactory;
|
||||
use Magento\Ui\Component\Listing\Columns\Column;
|
||||
|
||||
class SlideActions extends Column
|
||||
{
|
||||
|
||||
const URL_PATH_EDIT = 'olegnax_carousel/slide/edit';
|
||||
const URL_PATH_DELETE = 'olegnax_carousel/slide/delete';
|
||||
const URL_PATH_DETAILS = 'olegnax_carousel/slide/details';
|
||||
protected $urlBuilder;
|
||||
|
||||
/**
|
||||
* @param ContextInterface $context
|
||||
* @param UiComponentFactory $uiComponentFactory
|
||||
* @param UrlInterface $urlBuilder
|
||||
* @param array $components
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
ContextInterface $context,
|
||||
UiComponentFactory $uiComponentFactory,
|
||||
UrlInterface $urlBuilder,
|
||||
array $components = [],
|
||||
array $data = []
|
||||
) {
|
||||
$this->urlBuilder = $urlBuilder;
|
||||
parent::__construct($context, $uiComponentFactory, $components, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Data Source
|
||||
*
|
||||
* @param array $dataSource
|
||||
* @return array
|
||||
*/
|
||||
public function prepareDataSource(array $dataSource)
|
||||
{
|
||||
if (isset($dataSource['data']['items'])) {
|
||||
foreach ($dataSource['data']['items'] as & $item) {
|
||||
if (isset($item['slide_id'])) {
|
||||
$item[$this->getData('name')] = [
|
||||
'edit' => [
|
||||
'href' => $this->urlBuilder->getUrl(
|
||||
static::URL_PATH_EDIT,
|
||||
[
|
||||
'slide_id' => $item['slide_id']
|
||||
]
|
||||
),
|
||||
'label' => __('Edit')
|
||||
],
|
||||
'delete' => [
|
||||
'href' => $this->urlBuilder->getUrl(
|
||||
static::URL_PATH_DELETE,
|
||||
[
|
||||
'slide_id' => $item['slide_id']
|
||||
]
|
||||
),
|
||||
'label' => __('Delete'),
|
||||
'confirm' => [
|
||||
'title' => __('Delete "%1"', $item['slide_id']),
|
||||
'message' => __('Are you sure you wan\'t to delete a "%1" record?', $item['slide_id'])
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dataSource;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Olegnax\Carousel\Ui\Component\Listing\Column;
|
||||
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\ContextInterface;
|
||||
use Magento\Framework\View\Element\UiComponentFactory;
|
||||
use Magento\Ui\Component\Listing\Columns\Column;
|
||||
use Olegnax\Carousel\Model\ResourceModel\Carousel\Collection;
|
||||
use Olegnax\Carousel\Model\Slide\Source\Carousel;
|
||||
|
||||
class SlideCarousel extends Column
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*/
|
||||
protected $collection;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
public function __construct(
|
||||
ContextInterface $context,
|
||||
UiComponentFactory $uiComponentFactory,
|
||||
Carousel $optionsCarousel,
|
||||
array $components = [],
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $uiComponentFactory, $components, $data);
|
||||
$this->options = $optionsCarousel->toArray();
|
||||
}
|
||||
|
||||
public function prepareDataSource(array $dataSource)
|
||||
{
|
||||
if (isset($dataSource['data']['items'])) {
|
||||
foreach ($dataSource['data']['items'] as &$item) {
|
||||
$item['carousel'] = $this->getCarousel($item['carousel']);
|
||||
}
|
||||
}
|
||||
|
||||
return parent::prepareDataSource($dataSource);
|
||||
}
|
||||
|
||||
protected function getCarousel($identifier)
|
||||
{
|
||||
return array_key_exists($identifier, $this->options) ? $this->options[$identifier] : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Olegnax\Carousel\Ui\Component\Listing\Column;
|
||||
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\ContextInterface;
|
||||
use Magento\Framework\View\Element\UiComponentFactory;
|
||||
use Magento\Ui\Component\Listing\Columns\Column;
|
||||
use Olegnax\Carousel\Model\SlideFactory;
|
||||
|
||||
class SlideImage extends Column
|
||||
{
|
||||
/**
|
||||
* @var SlideFactory
|
||||
*/
|
||||
protected $slideFactory;
|
||||
|
||||
public function __construct(
|
||||
ContextInterface $context,
|
||||
UiComponentFactory $uiComponentFactory,
|
||||
SlideFactory $slideFactory,
|
||||
array $components = [],
|
||||
array $data = []
|
||||
) {
|
||||
$this->slideFactory = $slideFactory;
|
||||
parent::__construct($context, $uiComponentFactory, $components, $data);
|
||||
}
|
||||
|
||||
public function prepareDataSource(array $dataSource)
|
||||
{
|
||||
if (isset($dataSource['data']['items'])) {
|
||||
foreach ($dataSource['data']['items'] as &$item) {
|
||||
$_item = $this->slideFactory->create()->load($item['slide_id']);
|
||||
if ($_item->hasImage()) {
|
||||
$item['image'] =
|
||||
$item['image_link'] =
|
||||
$item['image_orig_src'] =
|
||||
$item['image_src'] = $_item->getImageUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::prepareDataSource($dataSource);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Olegnax\Carousel\Ui\Component\Listing\Column;
|
||||
|
||||
use Magento\Store\Ui\Component\Listing\Column\Store;
|
||||
|
||||
class SlideStore extends Store
|
||||
{
|
||||
protected function prepareItem(array $item)
|
||||
{
|
||||
$item[$this->storeKey] = empty($item[$this->storeKey]) ? '0' : $item[$this->storeKey];
|
||||
|
||||
if (!is_array($item[$this->storeKey])) {
|
||||
$item[$this->storeKey] = explode(',', $item[$this->storeKey]);
|
||||
}
|
||||
|
||||
return parent::prepareItem($item);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "olegnax/module-carousel",
|
||||
"description": "Any Content Carousel Slider",
|
||||
"type": "magento2-module",
|
||||
"license": [
|
||||
"OSL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Olegnax",
|
||||
"email": "mail@olegnax.com",
|
||||
"homepage": "https://olegnax.com",
|
||||
"role": "Technical Support"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"olegnax/module-core": ">=1.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"registration.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Olegnax\\Carousel\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
|
||||
<acl>
|
||||
<resources>
|
||||
<resource id="Magento_Backend::admin">
|
||||
<resource id="Olegnax_Core::Olegnax_Core">
|
||||
<resource id="Olegnax_Carousel::Carousel" sortOrder="10" title="Carousel">
|
||||
<resource id="Olegnax_Carousel::Carousel_save" sortOrder="10" title="Save Carousel"/>
|
||||
<resource id="Olegnax_Carousel::Carousel_delete" sortOrder="20" title="Delete Carousel"/>
|
||||
<resource id="Olegnax_Carousel::Carousel_view" sortOrder="40" title="View Carousel"/>
|
||||
<resource id="Olegnax_Carousel::Slide" sortOrder="60" title="Slide">
|
||||
<resource id="Olegnax_Carousel::Slide_save" sortOrder="10" title="Save Slide"/>
|
||||
<resource id="Olegnax_Carousel::Slide_delete" sortOrder="20" title="Delete Slide"/>
|
||||
<resource id="Olegnax_Carousel::Slide_view" sortOrder="40" title="View Slide"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
|
||||
<menu>
|
||||
<add id="Olegnax::top_level" module="Olegnax_Carousel" resource="Olegnax_Core::Olegnax_Core" parent="Olegnax_Core::Olegnax_Core" sortOrder="9999" title="Carousel"/>
|
||||
<add action="olegnax_carousel/carousel/index" id="Olegnax_Carousel::olegnax_carousel_carousel" module="Olegnax_Carousel" parent="Olegnax::top_level" resource="Olegnax_Carousel::Carousel" sortOrder="9999" title="Carousel"/>
|
||||
<add action="olegnax_carousel/slide/index" id="Olegnax_Carousel::olegnax_carousel_slide" module="Olegnax_Carousel" parent="Olegnax::top_level" resource="Olegnax_Carousel::Slide" sortOrder="9999" title="Slide"/>
|
||||
</menu>
|
||||
</config>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
|
||||
<router id="admin">
|
||||
<route frontName="olegnax_carousel" id="olegnax_carousel">
|
||||
<module before="Magento_Backend" name="Olegnax_Carousel"/>
|
||||
</route>
|
||||
</router>
|
||||
</config>
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" ?>
|
||||
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
|
||||
<table comment="olegnax_carousel_carousel Table" engine="innodb" name="olegnax_carousel_carousel" resource="default">
|
||||
<column comment="Entity Id" identity="true" name="carousel_id" nullable="false" padding="6" unsigned="true" xsi:type="smallint"/>
|
||||
<constraint referenceId="PRIMARY" xsi:type="primary">
|
||||
<column name="carousel_id"/>
|
||||
</constraint>
|
||||
<column length="255" name="title" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="identifier" nullable="true" xsi:type="varchar"/>
|
||||
<column default="CURRENT_TIMESTAMP" name="creation_time" nullable="false" xsi:type="timestamp"/>
|
||||
<column default="CURRENT_TIMESTAMP" name="update_time" nullable="false" xsi:type="timestamp"/>
|
||||
</table>
|
||||
<table comment="olegnax_carousel_slide Table" engine="innodb" name="olegnax_carousel_slide" resource="default">
|
||||
<column comment="Entity Id" identity="true" name="slide_id" nullable="false" padding="6" unsigned="true" xsi:type="smallint"/>
|
||||
<constraint referenceId="PRIMARY" xsi:type="primary">
|
||||
<column name="slide_id"/>
|
||||
</constraint>
|
||||
<column length="255" name="carousel" nullable="true" xsi:type="varchar"/>
|
||||
<column name="is_active" nullable="true" xsi:type="smallint"/>
|
||||
<column name="content_only" nullable="true" xsi:type="smallint"/>
|
||||
<column name="store_id" nullable="true" xsi:type="text"/>
|
||||
<column identity="false" name="sort_order" nullable="true" xsi:type="int"/>
|
||||
<column length="255" name="layout" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="mobile_align" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="margins" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="content_wrappers" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="slide_bg" nullable="true" xsi:type="varchar"/>
|
||||
<column name="slide_link" nullable="true" xsi:type="text"/>
|
||||
<column length="255" name="subtitle_color" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="title_color" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="title_bg" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="button_color" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="button_bg" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="button_color_hover" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="button_bg_hover" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="text_color" nullable="true" xsi:type="varchar"/>
|
||||
<column name="image" nullable="true" xsi:type="text"/>
|
||||
<column name="mobile_image" nullable="true" xsi:type="text"/>
|
||||
<column name="subtitle" nullable="true" xsi:type="text"/>
|
||||
<column name="title" nullable="true" xsi:type="text"/>
|
||||
<column length="255" name="title_size" nullable="true" xsi:type="varchar"/>
|
||||
<column length="255" name="button_style" nullable="true" xsi:type="varchar"/>
|
||||
<column name="content_width" nullable="true" xsi:type="text"/>
|
||||
<column name="custom_class" nullable="true" xsi:type="text"/>
|
||||
<column name="link" nullable="true" xsi:type="text"/>
|
||||
<column name="button_css" nullable="true" xsi:type="text"/>
|
||||
<column name="button" nullable="true" xsi:type="text"/>
|
||||
<column name="nav_title" nullable="true" xsi:type="text"/>
|
||||
<column name="content" nullable="true" xsi:type="text"/>
|
||||
<column name="content2" nullable="true" xsi:type="text"/>
|
||||
<column default="CURRENT_TIMESTAMP" name="creation_time" nullable="false" xsi:type="timestamp"/>
|
||||
<column default="CURRENT_TIMESTAMP" name="update_time" nullable="false" xsi:type="datetime"/>
|
||||
</table>
|
||||
</schema>
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Olegnax\Carousel\Api\CarouselRepositoryInterface" type="Olegnax\Carousel\Model\CarouselRepository"/>
|
||||
<preference for="Olegnax\Carousel\Api\Data\CarouselInterface" type="Olegnax\Carousel\Model\Data\Carousel"/>
|
||||
<preference for="Olegnax\Carousel\Api\Data\CarouselSearchResultsInterface" type="Magento\Framework\Api\SearchResults"/>
|
||||
<virtualType name="Olegnax\Carousel\Model\ResourceModel\Carousel\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
|
||||
<arguments>
|
||||
<argument name="mainTable" xsi:type="string">olegnax_carousel_carousel</argument>
|
||||
<argument name="resourceModel" xsi:type="string">Olegnax\Carousel\Model\ResourceModel\Carousel\Collection</argument>
|
||||
</arguments>
|
||||
</virtualType>
|
||||
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
|
||||
<arguments>
|
||||
<argument name="collections" xsi:type="array">
|
||||
<item name="olegnax_carousel_carousel_listing_data_source" xsi:type="string">Olegnax\Carousel\Model\ResourceModel\Carousel\Grid\Collection</item>
|
||||
<item name="olegnax_carousel_slide_listing_data_source" xsi:type="string">Olegnax\Carousel\Model\ResourceModel\Slide\Grid\Collection</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
<preference for="Olegnax\Carousel\Api\SlideRepositoryInterface" type="Olegnax\Carousel\Model\SlideRepository"/>
|
||||
<preference for="Olegnax\Carousel\Api\Data\SlideInterface" type="Olegnax\Carousel\Model\Data\Slide"/>
|
||||
<preference for="Olegnax\Carousel\Api\Data\SlideSearchResultsInterface" type="Magento\Framework\Api\SearchResults"/>
|
||||
<virtualType name="Olegnax\Carousel\Model\ResourceModel\Slide\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
|
||||
<arguments>
|
||||
<argument name="mainTable" xsi:type="string">olegnax_carousel_slide</argument>
|
||||
<argument name="resourceModel" xsi:type="string">Olegnax\Carousel\Model\ResourceModel\Slide\Collection</argument>
|
||||
</arguments>
|
||||
</virtualType>
|
||||
</config>
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Olegnax_Carousel" setup_version="1.1.0.6"/>
|
||||
</config>
|
||||
Executable
+252
@@ -0,0 +1,252 @@
|
||||
<?xml version="1.0" ?>
|
||||
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
|
||||
<widget class="Olegnax\Carousel\Block\Widget\Carousel" id="olegnax_carousel_carousel">
|
||||
<label>Olegnax - Carousel</label>
|
||||
<description>Slide anything!</description>
|
||||
<parameters>
|
||||
<parameter name="carousel" source_model="Olegnax\Carousel\Model\Slide\Source\Carousel" visible="true" xsi:type="select">
|
||||
<label>Choose Carousel</label>
|
||||
</parameter>
|
||||
<parameter name="css_only" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">CSS-only Carousel on Mobile</label>
|
||||
<description translate="true">Experimental option. Most of the settings will not work with the css-only carousel. For 1 Column carousel only. Requires Mobile theme. See docs for details.</description>
|
||||
</parameter>
|
||||
<parameter name="loop" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Loop Carousel</label>
|
||||
</parameter>
|
||||
<parameter name="rewind" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Rewind Carousel</label>
|
||||
<description translate="true">Slide to first item when the last one has reached.</description>
|
||||
<depends>
|
||||
<parameter name="loop" value="0"/>
|
||||
</depends>
|
||||
</parameter>
|
||||
<parameter name="nav" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Navigation Arrows</label>
|
||||
</parameter>
|
||||
<parameter name="nav_style" xsi:type="select" visible="true">
|
||||
<label translate="true">Navigation Arrows Style</label>
|
||||
<depends>
|
||||
<parameter name="nav" value="1"/>
|
||||
</depends>
|
||||
<options>
|
||||
<option name="theme" value="theme" selected="true">
|
||||
<label translate="true">Theme Default</label>
|
||||
</option>
|
||||
<option name="theme_big" value="theme nav-big">
|
||||
<label translate="true">Theme Big</label>
|
||||
</option>
|
||||
<option name="simple" value="simple">
|
||||
<label translate="true">Simple Arrows</label>
|
||||
</option>
|
||||
<option name="simple_small" value="simple nav-small">
|
||||
<label translate="true">Simple Arrows, Small</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="nav_always" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Always Show Arrows</label>
|
||||
<depends>
|
||||
<parameter name="nav" value="1"/>
|
||||
</depends>
|
||||
</parameter>
|
||||
<parameter name="dots" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Navigation Dots</label>
|
||||
</parameter>
|
||||
<parameter name="dots_align" xsi:type="select" visible="true">
|
||||
<label translate="true">Navigation Dots Horizontal Align</label>
|
||||
<depends>
|
||||
<parameter name="dots" value="1"/>
|
||||
</depends>
|
||||
<options>
|
||||
<option name="left" value="left" selected="true">
|
||||
<label translate="true">Left</label>
|
||||
</option>
|
||||
<option name="center" value="center">
|
||||
<label translate="true">Center</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="dots_position" xsi:type="select" visible="true">
|
||||
<label translate="true">Navigation Dots Position</label>
|
||||
<depends>
|
||||
<parameter name="dots" value="1"/>
|
||||
</depends>
|
||||
<options>
|
||||
<option name="over" value="over" selected="true">
|
||||
<label translate="true">Overlay slider</label>
|
||||
</option>
|
||||
<option name="below" value="below">
|
||||
<label translate="true">Below Slider</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="dots_overlay" xsi:type="select" visible="true">
|
||||
<label translate="true">Dots Background Gradient</label>
|
||||
<description translate="true">When dots over content.</description>
|
||||
<depends>
|
||||
<parameter name="dots" value="1"/>
|
||||
</depends>
|
||||
<options>
|
||||
<option name="yes" value="true" selected="true">
|
||||
<label translate="true">Yes</label>
|
||||
</option>
|
||||
<option name="false" value="false">
|
||||
<label translate="true">No</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="dots_style" xsi:type="select" visible="true">
|
||||
<label translate="true">Navigation Dots Style</label>
|
||||
<depends>
|
||||
<parameter name="dots" value="1"/>
|
||||
</depends>
|
||||
<options>
|
||||
<option name="lines" value="lines" selected="true">
|
||||
<label translate="true">Lines, Active Long</label>
|
||||
</option>
|
||||
<option name="lines_vertical" value="lines_vertical">
|
||||
<label translate="true">Lines, Active Taller</label>
|
||||
</option>
|
||||
<option name="lines_text" value="lines_text">
|
||||
<label translate="true">Lines with text</label>
|
||||
</option>
|
||||
<option name="rounded" value="rounded">
|
||||
<label translate="true">Rounded</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
|
||||
<parameter name="autoplay" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Autoplay</label>
|
||||
<description translate="true">Set timeout in seconds (1-10) to enable autoplay.
|
||||
</description>
|
||||
</parameter>
|
||||
<parameter name="pause_on_hover" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Pause on Hover</label>
|
||||
</parameter>
|
||||
<parameter name="progress" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Progress Bar</label>
|
||||
</parameter>
|
||||
<parameter name="progress_position" xsi:type="select" visible="true">
|
||||
<label translate="true">Progress Bar Position</label>
|
||||
<depends>
|
||||
<parameter name="progress" value="1"/>
|
||||
</depends>
|
||||
<options>
|
||||
<option name="top" value="top" selected="true">
|
||||
<label translate="true">Slide Top</label>
|
||||
</option>
|
||||
<option name="bottom" value="bottom">
|
||||
<label translate="true">Slide Bottom</label>
|
||||
</option>
|
||||
<option name="nav" value="nav">
|
||||
<label translate="true">In Navigation (Dots)</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="columns_desktop" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Columns Desktop</label>
|
||||
<value>1</value>
|
||||
</parameter>
|
||||
<parameter name="columns_desktop_small" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Columns Desktop Small</label>
|
||||
<value>1</value>
|
||||
</parameter>
|
||||
<parameter name="columns_tablet" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Columns Tablet</label>
|
||||
<value>1</value>
|
||||
</parameter>
|
||||
<parameter name="columns_mobile" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Columns Mobile</label>
|
||||
<value>1</value>
|
||||
</parameter>
|
||||
<parameter name="slider_height" xsi:type="select" visible="true">
|
||||
<label translate="true">Slider Height Depends on</label>
|
||||
<options>
|
||||
<option name="settings" value="settings" >
|
||||
<label translate="true">Slide Height Settings</label>
|
||||
</option>
|
||||
<option name="image" value="image" selected="true">
|
||||
<label translate="true">Slide Image Height</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="auto_height" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Auto Height</label>
|
||||
<description translate="true">Only for 1 item on screen and "Slider Height Depends on" Slide Image Height.
|
||||
</description>
|
||||
</parameter>
|
||||
<parameter name="height_desktop" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Slider Min-Heigh Desktop</label>
|
||||
</parameter>
|
||||
<parameter name="height_desktop_small" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Slider Min-Heigh Desktop Small</label>
|
||||
</parameter>
|
||||
<parameter name="height_tablet" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Slider Min-Heigh Tablet</label>
|
||||
</parameter>
|
||||
<parameter name="height_mobile" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Slider Min-Heigh Mobile</label>
|
||||
</parameter>
|
||||
<parameter name="lazy_load" xsi:type="select" visible="true">
|
||||
<label translate="true">Disable Lazy Load</label>
|
||||
<description translate="true">Disable carousel lazy load feature for images</description>
|
||||
<options>
|
||||
<option name="noexclude" value="noexclude" selected="true">
|
||||
<label translate="true">No</label>
|
||||
</option>
|
||||
<option name="exclude" value="exclude">
|
||||
<label translate="true">Yes</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="lazy_exclude_first" xsi:type="select" visible="true"
|
||||
source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Lazy Load: Exclude First Image</label>
|
||||
<description translate="true">This can improve page speed score if carousel is counted as LCP.</description>
|
||||
</parameter>
|
||||
<parameter name="arrows_icon_color" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Arrows Icon Color</label>
|
||||
</parameter>
|
||||
<parameter name="arrows_icon_bg" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Arrows Icon Background</label>
|
||||
</parameter>
|
||||
<parameter name="arrows_icon_color_hover" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Arrows Icon Color, Hover</label>
|
||||
</parameter>
|
||||
<parameter name="arrows_icon_bg_hover" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Arrows Icon Background, Hover</label>
|
||||
</parameter>
|
||||
<parameter name="progress_line" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Progress Line Color</label>
|
||||
</parameter>
|
||||
<parameter name="dot_color" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Dots Color</label>
|
||||
</parameter>
|
||||
<parameter name="dot_active_color" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Dots Color, Active/Hover</label>
|
||||
</parameter>
|
||||
<parameter name="dot_text_color" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Dots Text Color</label>
|
||||
</parameter>
|
||||
<parameter name="dot_gradient_one" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Dots Overlay Gradient Color1</label>
|
||||
<description translate="true">Default: rgba(0, 0, 0, 0.25)</description>
|
||||
</parameter>
|
||||
<parameter name="dot_gradient_two" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Dots Overlay Gradient Color2</label>
|
||||
<description translate="true">Default: rgba(0, 0, 0, 0)</description>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</widget>
|
||||
</widgets>
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
ComponentRegistrar::register(
|
||||
ComponentRegistrar::MODULE,
|
||||
'Olegnax_Carousel',
|
||||
__DIR__
|
||||
);
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="styles"/>
|
||||
<update handle="editor"/>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="olegnax_carousel_carousel_form"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="styles"/>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="olegnax_carousel_carousel_listing"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="olegnax_carousel_carousel_edit"/>
|
||||
</page>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="styles"/>
|
||||
<update handle="editor"/>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="olegnax_carousel_slide_form"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="styles"/>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="olegnax_carousel_slide_listing"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="olegnax_carousel_slide_edit"/>
|
||||
</page>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" ?>
|
||||
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">olegnax_carousel_carousel_form.carousel_form_data_source</item>
|
||||
</item>
|
||||
<item name="label" translate="true" xsi:type="string">General Information</item>
|
||||
<item name="template" xsi:type="string">templates/form/collapsible</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<buttons>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Carousel\Edit\BackButton" name="back"/>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Carousel\Edit\DeleteButton" name="delete"/>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Carousel\Edit\SaveButton" name="save"/>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Carousel\Edit\SaveAndContinueButton" name="save_and_continue"/>
|
||||
</buttons>
|
||||
<namespace>olegnax_carousel_carousel_form</namespace>
|
||||
<dataScope>data</dataScope>
|
||||
<deps>
|
||||
<dep>olegnax_carousel_carousel_form.carousel_form_data_source</dep>
|
||||
</deps>
|
||||
</settings>
|
||||
<dataSource name="carousel_form_data_source">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<submitUrl path="*/*/save"/>
|
||||
</settings>
|
||||
<dataProvider class="Olegnax\Carousel\Model\Carousel\DataProvider" name="carousel_form_data_source">
|
||||
<settings>
|
||||
<requestFieldName>carousel_id</requestFieldName>
|
||||
<primaryFieldName>carousel_id</primaryFieldName>
|
||||
</settings>
|
||||
</dataProvider>
|
||||
</dataSource>
|
||||
<fieldset name="general">
|
||||
<settings>
|
||||
<label>General</label>
|
||||
</settings>
|
||||
<field name="title" sortOrder="10" formElement="input">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">block</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Title</label>
|
||||
<dataScope>title</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field name="identifier" sortOrder="20" formElement="input">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">block</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Identifier</label>
|
||||
<dataScope>identifier</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
Executable
+126
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" ?>
|
||||
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">olegnax_carousel_carousel_listing.olegnax_carousel_carousel_listing_data_source</item>
|
||||
<item name="deps" xsi:type="string">olegnax_carousel_carousel_listing.olegnax_carousel_carousel_listing_data_source</item>
|
||||
</item>
|
||||
<item name="spinner" xsi:type="string">olegnax_carousel_carousel_columns</item>
|
||||
<item name="buttons" xsi:type="array">
|
||||
<item name="add" xsi:type="array">
|
||||
<item name="name" xsi:type="string">add</item>
|
||||
<item name="label" xsi:type="string" translate="true">Add new Carousel</item>
|
||||
<item name="class" xsi:type="string">primary</item>
|
||||
<item name="url" xsi:type="string">*/*/new</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
|
||||
<dataSource name="olegnax_carousel_carousel_listing_data_source">
|
||||
<argument name="dataProvider" xsi:type="configurableObject">
|
||||
<argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
|
||||
<argument name="name" xsi:type="string">olegnax_carousel_carousel_listing_data_source</argument>
|
||||
<argument name="primaryFieldName" xsi:type="string">carousel_id</argument>
|
||||
<argument name="requestFieldName" xsi:type="string">id</argument>
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="update_url" xsi:type="url" path="mui/index/render"/>
|
||||
<item name="storageConfig" xsi:type="array">
|
||||
<item name="indexField" xsi:type="string">carousel_id</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
</argument>
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
|
||||
</item>
|
||||
</argument>
|
||||
</dataSource>
|
||||
<listingToolbar name="listing_top">
|
||||
<settings>
|
||||
<sticky>true</sticky>
|
||||
</settings>
|
||||
<bookmark name="bookmarks"/>
|
||||
<columnsControls name="columns_controls"/>
|
||||
<filters name="listing_filters"/>
|
||||
<paging name="listing_paging"/>
|
||||
</listingToolbar>
|
||||
<columns name="olegnax_carousel_carousel_columns">
|
||||
<settings>
|
||||
<editorConfig>
|
||||
<param name="selectProvider" xsi:type="string">olegnax_carousel_carousel_listing.olegnax_carousel_carousel_listing.olegnax_carousel_carousel_columns.ids</param>
|
||||
<param name="enabled" xsi:type="boolean">true</param>
|
||||
<param name="indexField" xsi:type="string">carousel_id</param>
|
||||
<param name="clientConfig" xsi:type="array">
|
||||
<item name="saveUrl" path="olegnax_carousel/Carousel/inlineEdit" xsi:type="url"/>
|
||||
<item name="validateBeforeSave" xsi:type="boolean">false</item>
|
||||
</param>
|
||||
</editorConfig>
|
||||
<childDefaults>
|
||||
<param name="fieldAction" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">olegnax_carousel_carousel_listing.olegnax_carousel_carousel_listing.olegnax_carousel_carousel_columns_editor</item>
|
||||
<item name="target" xsi:type="string">startEdit</item>
|
||||
<item name="params" xsi:type="array">
|
||||
<item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
|
||||
<item name="1" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
</param>
|
||||
</childDefaults>
|
||||
</settings>
|
||||
<selectionsColumn name="ids">
|
||||
<settings>
|
||||
<indexField>carousel_id</indexField>
|
||||
</settings>
|
||||
</selectionsColumn>
|
||||
<column name="carousel_id" sortOrder="10">
|
||||
<settings>
|
||||
<label translate="true">ID</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="title" sortOrder="20">
|
||||
<settings>
|
||||
<sorting>asc</sorting>
|
||||
<filter>text</filter>
|
||||
<editor>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
<editorType>text</editorType>
|
||||
</editor>
|
||||
<label translate="true">Title</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="identifier" sortOrder="30">
|
||||
<settings>
|
||||
<filter>text</filter>
|
||||
<editor>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
<editorType>text</editorType>
|
||||
</editor>
|
||||
<label translate="true">Identifier</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="creation_time" sortOrder="40" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
|
||||
<settings>
|
||||
<filter>dateRange</filter>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">Created</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="update_time" sortOrder="50" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
|
||||
<settings>
|
||||
<filter>dateRange</filter>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">Modified</label>
|
||||
</settings>
|
||||
</column>
|
||||
<actionsColumn class="Olegnax\Carousel\Ui\Component\Listing\Column\CarouselActions" name="actions" sortOrder="60">
|
||||
<settings>
|
||||
<indexField>carousel_id</indexField>
|
||||
</settings>
|
||||
</actionsColumn>
|
||||
</columns>
|
||||
</listing>
|
||||
+593
@@ -0,0 +1,593 @@
|
||||
<?xml version="1.0" ?>
|
||||
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">olegnax_carousel_slide_form.slide_form_data_source</item>
|
||||
</item>
|
||||
<item name="label" translate="true" xsi:type="string">General Information</item>
|
||||
<item name="template" xsi:type="string">templates/form/collapsible</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<buttons>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Slide\Edit\BackButton" name="back"/>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Slide\Edit\DeleteButton" name="delete"/>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Slide\Edit\SaveButton" name="save"/>
|
||||
<button class="Olegnax\Carousel\Block\Adminhtml\Slide\Edit\SaveAndContinueButton" name="save_and_continue"/>
|
||||
</buttons>
|
||||
<namespace>olegnax_carousel_slide_form</namespace>
|
||||
<dataScope>data</dataScope>
|
||||
<deps>
|
||||
<dep>olegnax_carousel_slide_form.slide_form_data_source</dep>
|
||||
</deps>
|
||||
</settings>
|
||||
<dataSource name="slide_form_data_source">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<submitUrl path="*/*/save"/>
|
||||
</settings>
|
||||
<dataProvider class="Olegnax\Carousel\Model\Slide\DataProvider" name="slide_form_data_source">
|
||||
<settings>
|
||||
<requestFieldName>slide_id</requestFieldName>
|
||||
<primaryFieldName>slide_id</primaryFieldName>
|
||||
</settings>
|
||||
</dataProvider>
|
||||
</dataSource>
|
||||
<fieldset name="general">
|
||||
<settings>
|
||||
<label>General</label>
|
||||
</settings>
|
||||
<field formElement="checkbox" name="is_active" sortOrder="0">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
<item name="default" xsi:type="number">1</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>boolean</dataType>
|
||||
<label translate="true">Enable Slide</label>
|
||||
<dataScope>is_active</dataScope>
|
||||
|
||||
</settings>
|
||||
<formElements>
|
||||
<checkbox>
|
||||
<settings>
|
||||
<valueMap>
|
||||
<map name="false" xsi:type="number">0</map>
|
||||
<map name="true" xsi:type="number">1</map>
|
||||
</valueMap>
|
||||
<prefer>toggle</prefer>
|
||||
</settings>
|
||||
</checkbox>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="select" name="carousel" sortOrder="10">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Carousel</label>
|
||||
<dataScope>carousel</dataScope>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\Carousel"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field name="storeviews" formElement="multiselect" class="Magento\Store\Ui\Component\Form\Field\StoreView" sortOrder="20">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">block</item>
|
||||
<item name="default" xsi:type="number">0</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
<dataType>int</dataType>
|
||||
<tooltip>
|
||||
<link>https://docs.magento.com/m2/ce/user_guide/configuration/scope.html</link>
|
||||
<description>What is this?</description>
|
||||
</tooltip>
|
||||
<label translate="true">Store View</label>
|
||||
<dataScope>store_id</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<multiselect>
|
||||
<settings>
|
||||
<options class="Magento\Cms\Ui\Component\Listing\Column\Cms\Options"/>
|
||||
</settings>
|
||||
</multiselect>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="input" name="sort_order" sortOrder="30">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
<item name="default" xsi:type="number">10</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Sort Order</label>
|
||||
<dataScope>sort_order</dataScope>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">false</rule>
|
||||
</validation>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="checkbox" name="content_only" sortOrder="31">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
<item name="default" xsi:type="number">0</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>boolean</dataType>
|
||||
<label translate="true">Content Only</label>
|
||||
<dataScope>content_only</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<checkbox>
|
||||
<settings>
|
||||
<valueMap>
|
||||
<map name="false" xsi:type="number">0</map>
|
||||
<map name="true" xsi:type="number">1</map>
|
||||
</valueMap>
|
||||
<prefer>toggle</prefer>
|
||||
</settings>
|
||||
</checkbox>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="select" name="content_wrappers" sortOrder="35">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Content Wrappers</label>
|
||||
<dataScope>content_wrappers</dataScope>
|
||||
<tooltip>
|
||||
<description>1. With container - Slider content will have max width same as website. Use when your page/slider is full width and you want to limit its content width. 2. No container - use when slider is in content. 3. Raw - no additional wrappers at all. Build your own slide.</description>
|
||||
</tooltip>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\Wrappers"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="select" name="layout" sortOrder="40">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Content Position(Layout)</label>
|
||||
<dataScope>layout</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\Layout"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="select" name="mobile_align" sortOrder="41">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Content Mobile Align</label>
|
||||
<dataScope>mobile_align</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\MobileAlign"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="select" name="margins" sortOrder="42">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Margins Size</label>
|
||||
<dataScope>margins</dataScope>
|
||||
<tooltip>
|
||||
<description>Space between titles and content.</description>
|
||||
</tooltip>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\Margins"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="slide_bg" sortOrder="50">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Slide background</label>
|
||||
<dataScope>slide_bg</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="imageUploader" name="image" sortOrder="60">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Slide Image</label>
|
||||
<dataScope>image</dataScope>
|
||||
<elementTmpl>ui/form/element/uploader/image</elementTmpl>
|
||||
</settings>
|
||||
<formElements>
|
||||
<imageUploader>
|
||||
<settings>
|
||||
<required>false</required>
|
||||
<uploaderConfig>
|
||||
<param xsi:type="url" name="url" path="catalog/category_image/upload"/>
|
||||
</uploaderConfig>
|
||||
<previewTmpl>Magento_Catalog/image-preview</previewTmpl>
|
||||
<openDialogTitle>Media Gallery</openDialogTitle>
|
||||
<initialMediaGalleryOpenSubpath>catalog/category</initialMediaGalleryOpenSubpath>
|
||||
<allowedExtensions>jpg jpeg gif png</allowedExtensions>
|
||||
<maxFileSize>4194304</maxFileSize>
|
||||
</settings>
|
||||
</imageUploader>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="imageUploader" name="mobile_image" sortOrder="61">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Mobile Image</label>
|
||||
<dataScope>mobile_image</dataScope>
|
||||
<elementTmpl>ui/form/element/uploader/image</elementTmpl>
|
||||
</settings>
|
||||
<formElements>
|
||||
<imageUploader>
|
||||
<settings>
|
||||
<required>false</required>
|
||||
<uploaderConfig>
|
||||
<param xsi:type="url" name="url" path="catalog/category_image/upload"/>
|
||||
</uploaderConfig>
|
||||
<previewTmpl>Magento_Catalog/image-preview</previewTmpl>
|
||||
<openDialogTitle>Media Gallery</openDialogTitle>
|
||||
<initialMediaGalleryOpenSubpath>catalog/category</initialMediaGalleryOpenSubpath>
|
||||
<allowedExtensions>jpg jpeg gif png</allowedExtensions>
|
||||
<maxFileSize>4194304</maxFileSize>
|
||||
</settings>
|
||||
</imageUploader>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="input" name="slide_link" sortOrder="65">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Slide Url (link on entire slide)</label>
|
||||
<dataScope>slide_link</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="subtitle" sortOrder="70">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Subtitle</label>
|
||||
<dataScope>subtitle</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="subtitle_color" sortOrder="72">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Subtitle Color</label>
|
||||
<dataScope>subtitle_color</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="title" sortOrder="80">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>textarea</dataType>
|
||||
<label translate="true">Title</label>
|
||||
<dataScope>title</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="select" name="title_size" sortOrder="81">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Title Size</label>
|
||||
<dataScope>title_size</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\TitleSize"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="title_color" sortOrder="82">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Title Color</label>
|
||||
<dataScope>title_color</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="title_bg" sortOrder="83">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Title Background</label>
|
||||
<dataScope>title_bg</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="link" sortOrder="90">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Button Url</label>
|
||||
<dataScope>link</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="button" sortOrder="100">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Button Text</label>
|
||||
<dataScope>button</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="button_css" sortOrder="100">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Button Class</label>
|
||||
<dataScope>button_css</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="select" name="button_style" sortOrder="101">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Button Style</label>
|
||||
<dataScope>button_style</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\ButtonStyle"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="button_color" sortOrder="102">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Button Text Color</label>
|
||||
<dataScope>button_color</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="button_bg" sortOrder="103">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Button Bg Color</label>
|
||||
<dataScope>button_bg</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="button_color_hover" sortOrder="104">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Button Hover Text Color</label>
|
||||
<dataScope>button_color_hover</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="button_bg_hover" sortOrder="105">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Button Hover Bg Color</label>
|
||||
<dataScope>button_bg_hover</dataScope>
|
||||
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="content_width" sortOrder="190">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Content Max Width</label>
|
||||
<dataScope>content_width</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="wysiwyg" name="content" sortOrder="200">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<additionalClasses>
|
||||
<class name="admin__field-wide">true</class>
|
||||
</additionalClasses>
|
||||
<label translate="true">Main Content</label>
|
||||
<dataScope>content</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<wysiwyg>
|
||||
<settings>
|
||||
<wysiwyg>true</wysiwyg>
|
||||
</settings>
|
||||
</wysiwyg>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="wysiwyg" name="content2" sortOrder="201">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<additionalClasses>
|
||||
<class name="admin__field-wide">true</class>
|
||||
</additionalClasses>
|
||||
<label translate="true">Second Content</label>
|
||||
<dataScope>content2</dataScope>
|
||||
</settings>
|
||||
<formElements>
|
||||
<wysiwyg>
|
||||
<settings>
|
||||
<wysiwyg>true</wysiwyg>
|
||||
</settings>
|
||||
</wysiwyg>
|
||||
</formElements>
|
||||
</field>
|
||||
<field formElement="colorPicker" name="text_color" sortOrder="210">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Text Color</label>
|
||||
<dataScope>text_color</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="nav_title" sortOrder="210">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Navigation Text</label>
|
||||
<dataScope>nav_title</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
<field formElement="input" name="custom_class" sortOrder="900">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">Slide</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Slide Custom Classes</label>
|
||||
<dataScope>custom_class</dataScope>
|
||||
</settings>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" ?>
|
||||
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">olegnax_carousel_slide_listing.olegnax_carousel_slide_listing_data_source</item>
|
||||
<item name="deps" xsi:type="string">olegnax_carousel_slide_listing.olegnax_carousel_slide_listing_data_source</item>
|
||||
</item>
|
||||
<item name="spinner" xsi:type="string">olegnax_carousel_slide_columns</item>
|
||||
<item name="buttons" xsi:type="array">
|
||||
<item name="add" xsi:type="array">
|
||||
<item name="name" xsi:type="string">add</item>
|
||||
<item name="label" xsi:type="string" translate="true">Add new Slide</item>
|
||||
<item name="class" xsi:type="string">primary</item>
|
||||
<item name="url" xsi:type="string">*/*/new</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
<dataSource name="olegnax_carousel_slide_listing_data_source">
|
||||
<argument name="dataProvider" xsi:type="configurableObject">
|
||||
<argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
|
||||
<argument name="name" xsi:type="string">olegnax_carousel_slide_listing_data_source</argument>
|
||||
<argument name="primaryFieldName" xsi:type="string">slide_id</argument>
|
||||
<argument name="requestFieldName" xsi:type="string">id</argument>
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="update_url" xsi:type="url" path="mui/index/render"/>
|
||||
<item name="storageConfig" xsi:type="array">
|
||||
<item name="indexField" xsi:type="string">slide_id</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
</argument>
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
|
||||
</item>
|
||||
</argument>
|
||||
</dataSource>
|
||||
<listingToolbar name="listing_top">
|
||||
<settings>
|
||||
<sticky>true</sticky>
|
||||
</settings>
|
||||
<bookmark name="bookmarks"/>
|
||||
<columnsControls name="columns_controls"/>
|
||||
<filters name="listing_filters"/>
|
||||
<paging name="listing_paging"/>
|
||||
</listingToolbar>
|
||||
<columns name="olegnax_carousel_slide_columns">
|
||||
<settings>
|
||||
<editorConfig>
|
||||
<param name="selectProvider" xsi:type="string">olegnax_carousel_slide_listing.olegnax_carousel_slide_listing.olegnax_carousel_slide_columns.ids</param>
|
||||
<param name="enabled" xsi:type="boolean">true</param>
|
||||
<param name="indexField" xsi:type="string">slide_id</param>
|
||||
<param name="clientConfig" xsi:type="array">
|
||||
<item name="saveUrl" path="olegnax_carousel/Slide/inlineEdit" xsi:type="url"/>
|
||||
<item name="validateBeforeSave" xsi:type="boolean">false</item>
|
||||
</param>
|
||||
</editorConfig>
|
||||
<childDefaults>
|
||||
<param name="fieldAction" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">olegnax_carousel_slide_listing.olegnax_carousel_slide_listing.olegnax_carousel_slide_columns_editor</item>
|
||||
<item name="target" xsi:type="string">startEdit</item>
|
||||
<item name="params" xsi:type="array">
|
||||
<item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
|
||||
<item name="1" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
</param>
|
||||
</childDefaults>
|
||||
</settings>
|
||||
<selectionsColumn name="ids">
|
||||
<settings>
|
||||
<indexField>slide_id</indexField>
|
||||
</settings>
|
||||
</selectionsColumn>
|
||||
<column name="slide_id" sortOrder="10">
|
||||
<settings>
|
||||
<label translate="true">ID</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="carousel" class="Olegnax\Carousel\Ui\Component\Listing\Column\SlideCarousel" sortOrder="20">
|
||||
<settings>
|
||||
<options class="Olegnax\Carousel\Model\Slide\Source\Carousel"/>
|
||||
<filter>select</filter>
|
||||
<dataType>select</dataType>
|
||||
<label translate="true">Carousel</label>
|
||||
<sorting>asc</sorting>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="store_id" class="Olegnax\Carousel\Ui\Component\Listing\Column\SlideStore" sortOrder="30">
|
||||
<settings>
|
||||
<label translate="true">Store View</label>
|
||||
<bodyTmpl>ui/grid/cells/html</bodyTmpl>
|
||||
<sortable>false</sortable>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="image" class="Olegnax\Carousel\Ui\Component\Listing\Column\SlideImage" component="Magento_Ui/js/grid/columns/thumbnail" sortOrder="50">
|
||||
<settings>
|
||||
<label translate="true">Background Image</label>
|
||||
<hasPreview>1</hasPreview>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="sort_order" sortOrder="60">
|
||||
<settings>
|
||||
<filter>text</filter>
|
||||
<label translate="true">Sort Order</label>
|
||||
<sorting>asc</sorting>
|
||||
<editor>
|
||||
<editorType>text</editorType>
|
||||
<validation>
|
||||
<rule name="required-entry" xsi:type="boolean">false</rule>
|
||||
</validation>
|
||||
</editor>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="is_active" component="Magento_Ui/js/grid/columns/select" sortOrder="70">
|
||||
<settings>
|
||||
<options class="Magento\Cms\Model\Block\Source\IsActive"/>
|
||||
<filter>select</filter>
|
||||
<editor>
|
||||
<editorType>select</editorType>
|
||||
</editor>
|
||||
<dataType>select</dataType>
|
||||
<label translate="true">Status</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="creation_time" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date" sortOrder="80">
|
||||
<settings>
|
||||
<filter>dateRange</filter>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">Created</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="update_time" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date" sortOrder="90">
|
||||
<settings>
|
||||
<filter>dateRange</filter>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">Modified</label>
|
||||
</settings>
|
||||
</column>
|
||||
<actionsColumn class="Olegnax\Carousel\Ui\Component\Listing\Column\SlideActions" name="actions" sortOrder="100">
|
||||
<settings>
|
||||
<indexField>slide_id</indexField>
|
||||
</settings>
|
||||
</actionsColumn>
|
||||
</columns>
|
||||
</listing>
|
||||
@@ -0,0 +1,5 @@
|
||||
var config = {
|
||||
paths: {
|
||||
'OXCarousel': 'Olegnax_Carousel/oxcarousel'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
/*
|
||||
Content Wrappers:
|
||||
- With container. Slider content will have max width same as website. Use when your website is full width.
|
||||
- No container, use when slider is in content.
|
||||
- raw, no additional wrappers at all. Build your own slide. (no paddings)
|
||||
|
||||
* no container will have paddings. maybe add 2 variations of paddins: small big?
|
||||
|
||||
2 cols layouts with
|
||||
|
||||
custom css for each element
|
||||
|
||||
rework widget options to yes no
|
||||
* */
|
||||
|
||||
use Olegnax\Carousel\Block\Widget\Carousel;
|
||||
use Olegnax\Carousel\Helper\Helper;
|
||||
use Olegnax\Carousel\Model\Slide;
|
||||
use Magento\Framework\Escaper;
|
||||
|
||||
/** @var Carousel $block */
|
||||
/** @var Helper $helper */
|
||||
/** @var Escaper $escaper */
|
||||
$helper = $this->helper( Helper::class );
|
||||
$carousel = $block->getCarousel();
|
||||
$slides = $block->getSlide();
|
||||
if ( !$carousel || 0 == count( $slides ) ) {
|
||||
return;
|
||||
}
|
||||
$baseUrl = $escaper->escapeUrl(rtrim((string)$block->getBaseUrl(),"/"));
|
||||
$slider_id = $escaper->escapeHtml($block->getCarouselId());
|
||||
$nolazy = ($block->getLazyLoad() === 'exclude') ?: 0;
|
||||
$progress = (bool) $block->getProgress();
|
||||
$autoscroll = $block->getAutoScroll();
|
||||
$dotsData = false;
|
||||
$dotsStyle = $block->getDotsStyle();
|
||||
$sliderHeight = $escaper->escapeHtmlAttr($block->getSliderHeight());
|
||||
$classes = $customStyles = [];
|
||||
if((bool) $block->getNav()){
|
||||
$classes[] = 'ox-nav__' . $block->getNavStyle();
|
||||
$classes[] = $block->getNavAlways() ? 'ox-nav__always' : '';
|
||||
}
|
||||
if((bool) $block->getDots()){
|
||||
$classes[] = 'ox-dots__a-' . $block->getDotsAlign();
|
||||
$classes[] = 'ox-dots__p-' . $block->getDotsPosition();
|
||||
$classes[] = 'ox-dots__s-' . $dotsStyle;
|
||||
$classes[] = ($block->getDotsOverlay() == 'true') ? 'ox-dots__overlay' : '';
|
||||
}
|
||||
if($progress){
|
||||
$classes[] = 'ox-progress__p-' . $block->getProgressPosition();
|
||||
}
|
||||
$classes[] = 'ox-transition__' . $block->getSlideTransition();
|
||||
$classes[] = 'ox-slider-height__' . $sliderHeight;
|
||||
$pauseHover = (bool)($autoscroll && !$block->getPauseOnHover() && $progress);
|
||||
if($dotsStyle == 'lines_text' || $dotsStyle == 'lines_text_big' || $dotsStyle == 'lines_text_full'){
|
||||
$dotsData = true;
|
||||
}
|
||||
$topProgress = '';
|
||||
if($progress && $autoscroll && ($block->getProgressPosition() == 'top' || $block->getProgressPosition() == 'bottom')) {
|
||||
$topProgress = true;
|
||||
}
|
||||
$placeholder = "";
|
||||
|
||||
$excludeFirst =$block->getLazyExcludeFirst();
|
||||
$cssonly = false;
|
||||
$mobile_theme = false;
|
||||
$cssOnlyEnabled = $block->getCssOnly();
|
||||
if($cssOnlyEnabled){
|
||||
$mobile_theme = $this->helper( 'Olegnax\Core\Helper\Helper' )->isMobileTheme();
|
||||
if($mobile_theme){
|
||||
$cssonly = true;
|
||||
$classes[] = 'owl-loaded';
|
||||
}
|
||||
}
|
||||
|
||||
$index = 1;
|
||||
$cssNavDots = [];
|
||||
?>
|
||||
|
||||
<div id="<?php echo $slider_id ?>" class="block widget owl-carousel ox-carousel <?php echo $escaper->escapeHtml(implode(' ', $classes )) ?>" <?php if(!$cssonly) { ?> data-mage-init='{"OXCarousel":<?php echo
|
||||
json_encode( [
|
||||
'autoScroll' => $autoscroll,
|
||||
'loop' => (bool) $block->getLoop(),
|
||||
'rewind' => (bool) $block->getRewind(),
|
||||
'lazyLoad' => !(bool) $nolazy,
|
||||
'responsive' => $block->getResponsive( false ),
|
||||
'dotsData' => ($dotsData && (bool)$block->getDots()),
|
||||
'dots' => (bool) $block->getDots(),
|
||||
'nav' => (bool) $block->getNav(),
|
||||
'progress' => $progress,
|
||||
'autoHeight' => (bool) $block->getAutoHeight(),
|
||||
'autoplayHoverPause' => !$pauseHover,
|
||||
'smartSpeed' => 450,
|
||||
] );
|
||||
?>}' <?php } ?>>
|
||||
<?php if($cssonly) { ?>
|
||||
<div class="ox-carousel-css-only">
|
||||
<?php } ?>
|
||||
<?php
|
||||
/** @var Slide $slide */
|
||||
foreach ( $slides as $slide ) : ?>
|
||||
<?php
|
||||
$slide_link = $escaper->escapeUrl($slide->getSlideLink());
|
||||
$title = $escaper->escapeHtmlAttr($slide->getTitle());
|
||||
$customStyles[] = $block->customStyles($slider_id, $slide);
|
||||
$dotsContent = $progressItem = '';
|
||||
if($dotsData){
|
||||
if($progress && $autoscroll && $block->getProgressPosition() == 'nav'){
|
||||
$progressItem = '<span class=\'progress\'></span>';
|
||||
}
|
||||
$dotsContent = 'data-dot="<button role=\'button\' class=\'owl-dot dot\'><span class=\'title\'>' . $escaper->escapeHtml($slide->getNavTitle()) . '</span>' . $progressItem . '</button>"';
|
||||
}
|
||||
$image = $escaper->escapeUrl($slide->getImageUrl());
|
||||
$imageMobile = $escaper->escapeUrl($slide->getImageUrl('mobile_image'));
|
||||
$bgImage = '';
|
||||
$slideId = $escaper->escapeHtml($slide->getData( 'slide_id' ));
|
||||
if($sliderHeight == 'settings' && $image){ $bgImage = 'url(' . $image . ')'; }
|
||||
$slideClasses = [];
|
||||
$slideClasses[] = 'ox-slide-item';
|
||||
$slideClasses[] = '-v-center';
|
||||
$slideClasses[] = 'slide-layout-' . $slide->getContentWrappers();
|
||||
$slideClasses[] = 'slide-content-' . $slide->getLayout();
|
||||
$slideClasses[] = 'slide' . $slideId;
|
||||
$slideClasses[] = 'margins-' . $slide->getMargins();
|
||||
$slideClasses[] = 'align-s-' . $slide->getMobileAlign();
|
||||
|
||||
$slideClasses[] = $block->getCustomClass();
|
||||
$itemId = 'id="ox-carousel-slide' . $slideId . '-' . $index . '"';
|
||||
$cssNavDots[] = '<a href="#ox-carousel-slide' . $slideId . '-' . $index . '"><span>' . ($escaper->escapeHtmlAttr($slide->getNavTitle()) ?: $index) . '</span></a>';
|
||||
?>
|
||||
<div <?php echo $itemId ?> class="<?php echo $escaper->escapeHtml(implode(' ', $slideClasses )) ?>" style="<?php echo $block->prepareStyle( [ 'background-color' => $slide->getSlideBg() ] ) ?>" <?php if(!$cssonly){ echo $dotsContent; } ?> >
|
||||
<?php if($slide_link != ''){ ?>
|
||||
<a href="<?php echo $slide_link ?>" class="overlay-link"></a>
|
||||
<?php } ?>
|
||||
<?php if($image){ ?>
|
||||
<?php if(!(bool) $nolazy && (($excludeFirst && $index>1) || !$excludeFirst)) { ?>
|
||||
<img src="<?php echo $baseUrl . $image; ?>"
|
||||
<?php if($imageMobile) { ?> data-originalset="<?php echo $baseUrl . $imageMobile . ' 768w, ' . $baseUrl . $image; ?>"<?php } ?>
|
||||
class="ox-carousel__img" alt="<?php echo $escaper->escapeHtmlAttr($title) ?>">
|
||||
<?php } else { ?>
|
||||
<img src="<?php echo $baseUrl . $image; ?>" class="ox-carousel__img" alt="<?php echo $escaper->escapeHtmlAttr($title) ?>"
|
||||
<?php if($imageMobile) { ?>srcset="<?php echo $baseUrl . $imageMobile . ' 768w, ' . $baseUrl . $image; ?>"<?php } ?>
|
||||
data-ox-image>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if($topProgress) { ?>
|
||||
<span class="progress"></span>
|
||||
<?php } ?>
|
||||
<?php if ($slide->getContentWrappers() == 'container') { ?>
|
||||
<?php if ($slide->getLayout() == '2-col') { ?>
|
||||
<div class="ox-carousel__wrapper container">
|
||||
<div class="ox-carousel__row">
|
||||
<div class="ox-carousel__col">
|
||||
<?php echo $helper->getLayoutTemplateHtmlbyValue($block, 'content', null, ['slide' => $slide]); ?>
|
||||
</div>
|
||||
<div class="ox-carousel__col">
|
||||
<?php echo $slide->getContent2(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="ox-carousel__wrapper container">
|
||||
<div class="ox-carousel__inner">
|
||||
<?php echo $helper->getLayoutTemplateHtmlbyValue($block, 'content', null, ['slide' => $slide]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if($slide->getContentWrappers()=='no-container') { ?>
|
||||
<?php if ($slide->getLayout() == '2-col') { ?>
|
||||
<div class="ox-carousel__row">
|
||||
<div class="ox-carousel__col">
|
||||
<?php echo $helper->getLayoutTemplateHtmlbyValue($block, 'content', null, ['slide' => $slide]); ?>
|
||||
</div>
|
||||
<div class="ox-carousel__col">
|
||||
<?php echo $slide->getContent2(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="ox-carousel__inner">
|
||||
<?php echo $helper->getLayoutTemplateHtmlbyValue($block, 'content', null, ['slide' => $slide]); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if($slide->getContentWrappers()=='raw') { ?>
|
||||
<?php echo $slide->getContent(); ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
$index++;
|
||||
endforeach; ?>
|
||||
<?php if($cssonly) { ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($cssonly && count($cssNavDots) > 1 && (bool)$block->getDots()): ?>
|
||||
<div class="owl-dots ox-css-dots">
|
||||
<?php echo implode('', $cssNavDots); ?>
|
||||
</div>
|
||||
<?php
|
||||
$customStyles[] ='.ox-carousel .ox-css-dots{
|
||||
padding-top: 15px;
|
||||
margin-left: -5px;
|
||||
display:block;
|
||||
z-index: 2;
|
||||
}
|
||||
.ox-carousel .ox-css-dots > a span{
|
||||
width: 27px;
|
||||
height: 2px;
|
||||
display: inline-block;
|
||||
background-color: black;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.ox-carousel .ox-css-dots > a{
|
||||
display: inline-block;
|
||||
padding: 10px 5px;
|
||||
font-size: 0;
|
||||
}
|
||||
.ox-carousel.ox-dots__s-lines_text .ox-css-dots > a span{
|
||||
background-color: white;
|
||||
}
|
||||
@supports (scroll-snap-type) {
|
||||
.ox-carousel .css-dots > a {
|
||||
display: none;
|
||||
}
|
||||
}';
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if($progress && $autoscroll && !$cssonly){
|
||||
$customStyles[] = '#'. $slider_id . ' .owl-dot.active .progress:before{ animation: ' . $this->getData( 'autoplay' ) . 's linear 0s 1 normal forwards running progress-horizontal }';
|
||||
if(!$pauseHover){
|
||||
$customStyles[] = '#' . $slider_id . ':hover .owl-dot.active .progress:before{ animation-play-state: paused; }';
|
||||
}
|
||||
}
|
||||
if($topProgress && !$cssonly) {
|
||||
$customStyles[] = '#'. $slider_id . ' .owl-item.active .ox-slide-item > .progress:before{ animation: ' . $this->getData( 'autoplay' ) . 's linear 0s 1 normal forwards running progress-horizontal }';
|
||||
if(!$pauseHover){
|
||||
$customStyles[] = '#' . $slider_id . ':hover .owl-item.active .ox-slide-item > .progress:before{ animation-play-state: paused; }';
|
||||
}
|
||||
}
|
||||
if($sliderHeight == 'settings'){
|
||||
if(!empty($block->getHeightDesktop())){
|
||||
$customStyles[] = '#' . $slider_id. ', #' . $slider_id. ' .ox-slide-item { height:' . $block->getHeightDesktop() . 'px}';
|
||||
}
|
||||
if(!empty($block->getHeightDesktopSmall())){
|
||||
$customStyles[] = '@media (max-width: 1160px){ #' . $slider_id. ', #' . $slider_id. ' .ox-slide-item { height:' . $block->getHeightDesktopSmall() . 'px} }';
|
||||
}
|
||||
if(!empty($block->getHeightTablet())){
|
||||
$customStyles[] = '@media (max-width: 1024px){ #' . $slider_id. ', #' . $slider_id. ' .ox-slide-item { height:' . $block->getHeightTablet() . 'px} }';
|
||||
}
|
||||
if(!empty($block->getHeightMobile())){
|
||||
$customStyles[] = '@media (max-width: 768px){ #' . $slider_id. ', #' . $slider_id. ' .ox-slide-item { height:' . $block->getHeightMobile() . 'px} }';
|
||||
}
|
||||
}
|
||||
if(!empty($block->getDotGradientOne()) && !empty($block->getDotGradientTwo())) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel.ox-dots__p-over.ox-dots__overlay .ox-slide-item:before{background: linear-gradient(to top, '. $block->getDotGradientOne(). ' 10%, '. $block->getDotGradientTwo(). ' 100%);}';
|
||||
}
|
||||
if(!empty($block->getDotTextColor())) {
|
||||
if($cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .ox-css-dots > a span { color:' . $block->getDotTextColor() . ' }';
|
||||
} else {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel.ox-dots__s-lines_text_full .owl-dots button.dot span.title,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-dots__s-lines_text_big .owl-dots button.dot span.title,'.
|
||||
'#' . $slider_id . '.ox-carousel.ox-dots__s-lines_text .owl-dots button.dot span.title{ color: ' . $block->getDotTextColor() . '}';
|
||||
}
|
||||
}
|
||||
if(!empty($block->getDotColor()) && !$cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .owl-dots button.owl-dot span{ background: ' . $block->getDotColor() . ' }';
|
||||
}
|
||||
if(!empty($block->getDotActiveColor())) {
|
||||
if($cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .ox-css-dots > a span {background:' . $block->getDotActiveColor() . ' }';
|
||||
} else {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .owl-dots .active button.owl-dot span, #' .
|
||||
$slider_id . '.ox-carousel .owl-dots button.owl-dot.active span, #' .
|
||||
$slider_id . '.ox-carousel .owl-dots button.dot:hover span.progress{ background: ' . $block->getDotActiveColor() . ' }';
|
||||
}
|
||||
}
|
||||
if(!empty($block->getProgressLine()) && !$cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .owl-item.active .ox-slide-item > .progress:before, #' .
|
||||
$slider_id . '.ox-carousel.ox-progress__p-nav .owl-dots button.dot span.progress:before { background: ' . $block->getProgressLine() . '}';
|
||||
}
|
||||
if(!empty($block->getArrowsIconColor()) && !$cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .owl-nav button.owl-next span:before,'.
|
||||
'#' . $slider_id . '.ox-carousel .owl-nav button.owl-prev span:before,' .
|
||||
'#' . $slider_id . '.ox-carousel .owl-nav button.owl-next span:after,' .
|
||||
'#' . $slider_id . '.ox-carousel .owl-nav button.owl-prev span:after,'.
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-next span:before,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-prev span:before,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-next span:after,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-prev span:after{ background: ' . $block->getArrowsIconColor() .' }';
|
||||
}
|
||||
if(!empty($block->getArrowsIconColorHover()) && !$cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel .owl-nav button.owl-next:hover span:before,'.
|
||||
'#' . $slider_id . '.ox-carousel .owl-nav button.owl-prev:hover span:before,' .
|
||||
'#' . $slider_id . '.ox-carousel .owl-nav button.owl-next:hover span:after,' .
|
||||
'#' . $slider_id . '.ox-carousel .owl-nav button.owl-prev:hover span:after,'.
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-next:hover span:before,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-prev:hover span:before,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-next:hover span:after,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__simple .owl-nav button.owl-prev:hover span:after{ background: ' . $block->getArrowsIconColorHover() .' }';
|
||||
}
|
||||
if(!empty($block->getArrowsIconBg()) && !$cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel.ox-nav__theme .owl-nav button.owl-next,'.
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__theme .owl-nav button.owl-prev { background: ' . $block->getArrowsIconBg() .' }';
|
||||
}
|
||||
if(!empty($block->getArrowsIconBgHover()) && !$cssonly) {
|
||||
$customStyles[] = '#' . $slider_id . '.ox-carousel.ox-nav__theme .owl-nav button.owl-next:after,' .
|
||||
'#' . $slider_id . '.ox-carousel.ox-nav__theme .owl-nav button.owl-prev:after { background: ' . $block->getArrowsIconBgHover() .' }';
|
||||
}
|
||||
if($cssonly) {
|
||||
$customStyles[] ='
|
||||
.ox-carousel-css-only{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
overflow-y: hidden;
|
||||
overflow-x: auto;
|
||||
scroll-snap-type: x mandatory;
|
||||
scroll-behavior: smooth;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.ox-carousel-css-only::-webkit-scrollbar {
|
||||
width: 0px;
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
.ox-carousel-css-only::-webkit-scrollbar-thumb {
|
||||
background: black;
|
||||
border-radius: 0;
|
||||
}
|
||||
.ox-carousel-css-only::-webkit-scrollbar-track {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.ox-carousel-css-only .ox-slide-item {
|
||||
-ms-flex: 0 0 100%;
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
margin-bottom: 4px;
|
||||
scroll-snap-align: start;
|
||||
}';
|
||||
}
|
||||
if ( !empty($customStyles) ){
|
||||
echo '<style>' . implode(' ', $customStyles) . '</style>';
|
||||
}
|
||||
unset($customStyles);
|
||||
?>
|
||||
</div>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$slide = $this->getData( 'slide' );
|
||||
|
||||
if ( !$slide->getContentOnly() ) {
|
||||
$subtitle = $slide->getSubtitle();
|
||||
if ( !empty( $subtitle ) ) {
|
||||
echo '<h6 class="subtitle">' . $subtitle . '</h6>';
|
||||
}
|
||||
$title = $slide->getTitle();
|
||||
if ( !empty( $title ) ) {
|
||||
echo '<h2 class="title ' . $slide->getTitleSize() . '" >' . $title . '</h2>';
|
||||
}
|
||||
echo '<div class="ox-carousel__content">' . $slide->getContent() . '</div>';
|
||||
|
||||
if ( $slide->getButton() && $slide->getLink() ) {
|
||||
echo '<a href="' . $escaper->escapeUrl($slide->getLink()) . '" class="button ox-slide__button ' . $slide->getButtonStyle() . ' ' . $slide->getButtonCss() .'" ><span>' . $escaper->escapeHtml($slide->getButton()) . '</span></a>';
|
||||
}
|
||||
} else {
|
||||
echo $slide->getContent();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@import "module/_base.less";
|
||||
@import "module/_progress.less";
|
||||
@import "module/_arrows.less";
|
||||
@import "module/_dots.less";
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
& when (@media-common = true) {
|
||||
.ox-carousel {
|
||||
.owl-nav {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s, visibility 0.2s;
|
||||
button {
|
||||
transition: transform 0.2s ease;
|
||||
&.owl-next,
|
||||
&.owl-prev {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
&.owl-prev {
|
||||
transform: translateX(-20px) translateY(-50%);
|
||||
}
|
||||
&.owl-next {
|
||||
transform: translateX(20px) translateY(-50%);
|
||||
span {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover{
|
||||
.owl-nav {
|
||||
button {
|
||||
&.owl-prev,
|
||||
&.owl-next {
|
||||
transform: translateX(0) translateY(-50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-nav__always{
|
||||
.owl-nav {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
button {
|
||||
&.owl-prev,
|
||||
&.owl-next {
|
||||
transform: translateX(0) translateY(-50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-nav__simple {
|
||||
.owl-nav {
|
||||
button {
|
||||
&:hover{
|
||||
&.owl-next {
|
||||
span{
|
||||
transform: translateX(10px) rotate(180deg);
|
||||
}
|
||||
}
|
||||
&.owl-prev {
|
||||
span{
|
||||
transform: translateX(-10px);
|
||||
}
|
||||
}
|
||||
span {
|
||||
&:before,
|
||||
&:after {
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.owl-next,
|
||||
&.owl-prev {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
background: none;
|
||||
&:hover:after{
|
||||
background:none;
|
||||
}
|
||||
span {
|
||||
transition: 0.2s ease transform;
|
||||
height:38px;
|
||||
line-height: 38px;
|
||||
width:24px;
|
||||
&:before,
|
||||
&:after {
|
||||
background: #fff;
|
||||
height: 23px;
|
||||
left: 9px;
|
||||
width:3px;
|
||||
}
|
||||
&:after{
|
||||
top: 15px;
|
||||
}
|
||||
}
|
||||
&:after {
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.owl-prev {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
&.owl-next {
|
||||
right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.nav-small{
|
||||
.owl-nav {
|
||||
button {
|
||||
&.owl-next,
|
||||
&.owl-prev {
|
||||
width: 23px;
|
||||
height: 26px;
|
||||
span {
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
width: 18px;
|
||||
&:before,
|
||||
&:after {
|
||||
height: 10px;
|
||||
left: 9px;
|
||||
width:2px;
|
||||
}
|
||||
&:after{
|
||||
top: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ox-nav__theme {
|
||||
.owl-nav {
|
||||
button {
|
||||
&.owl-next,
|
||||
&.owl-prev {
|
||||
width: 40px;
|
||||
height: 56px;
|
||||
background: #000000;
|
||||
span {
|
||||
&:before,
|
||||
&:after {
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.owl-prev {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&.owl-next {
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.nav-big{
|
||||
.owl-nav {
|
||||
button {
|
||||
&.owl-next,
|
||||
&.owl-prev {
|
||||
width: 50px;
|
||||
height: 70px;
|
||||
span {
|
||||
line-height: 32px;
|
||||
height: 32px;
|
||||
&:before,
|
||||
&:after {
|
||||
height: 20px;
|
||||
width: 3px;
|
||||
left:0;
|
||||
}
|
||||
&:after{
|
||||
top: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
|
||||
.ox-carousel {
|
||||
&:hover {
|
||||
.owl-nav {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,452 @@
|
||||
& when (@media-common = true) {
|
||||
.page-wrapper > .widget.ox-carousel{
|
||||
max-width:100%;
|
||||
width:100%;
|
||||
padding:0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.ox-carousel {
|
||||
position: relative;
|
||||
.overlay-link{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
z-index: 2;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: pointer;
|
||||
&:before,
|
||||
&:after{
|
||||
content:none!important;
|
||||
}
|
||||
}
|
||||
&.owl-carousel {
|
||||
display: block;
|
||||
overflow:hidden;
|
||||
&:not(.owl-loaded){
|
||||
> *{
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
&.ox-slider-height__image:not(.owl-loaded) {
|
||||
display: flex!important;
|
||||
> *{
|
||||
display: block !important;
|
||||
width: 100%;
|
||||
flex: 0 0 100%;
|
||||
position: relative;
|
||||
line-height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.block,
|
||||
&.widget{
|
||||
margin: 0 auto;
|
||||
}
|
||||
.ox-slide-item{
|
||||
overflow: hidden;
|
||||
.ox-carousel__wrapper{
|
||||
z-index: 1;
|
||||
}
|
||||
.subtitle{
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.title{
|
||||
margin-bottom: 16px;
|
||||
|
||||
&.huge-6vw,
|
||||
&.huge-7vw,
|
||||
&.big,
|
||||
&.huge{
|
||||
font-size: 48px;
|
||||
}
|
||||
}
|
||||
.ox-carousel__col,
|
||||
.ox-carousel__inner{
|
||||
> a.ox-slide__button{
|
||||
margin-top: 25px;
|
||||
}
|
||||
> *:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
.subtitle + a.ox-slide__button,
|
||||
.title + a.ox-slide__button{
|
||||
margin-top: 0;
|
||||
}
|
||||
.ox-carousel__col{
|
||||
img{
|
||||
width:auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-carousel__col,
|
||||
.ox-carousel__inner{
|
||||
> a.ox-slide__button{
|
||||
margin-top: 35px;
|
||||
}
|
||||
> *:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
.ox-carousel__inner{
|
||||
z-index: 1;
|
||||
padding:40px;
|
||||
max-width:100%;
|
||||
}
|
||||
&.ox-slider-height__settings{
|
||||
.ox-carousel__wrapper{
|
||||
height:100%;
|
||||
}
|
||||
.ox-slide-item{
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
&.slide-content-center,
|
||||
&.slide-content-right,
|
||||
&.slide-content-left{
|
||||
.lib-vendor-prefix-display(flex);
|
||||
.lib-vendor-box-align(center);
|
||||
}
|
||||
&.slide-content-right{
|
||||
.ox-carousel__inner{
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
&.slide-content-center{
|
||||
.ox-carousel__inner{
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
&.slide-layout-raw{
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-carousel__img{
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
&.ox-slider-height__image{
|
||||
.ox-carousel__wrapper {
|
||||
position: relative;
|
||||
touch-action: manipulation;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom:0;
|
||||
top: -100%;
|
||||
}
|
||||
.ox-carousel__inner{
|
||||
position:absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: list-item;
|
||||
max-width: 1400px;
|
||||
list-style: none;
|
||||
margin: 0 auto;
|
||||
padding: 30px;
|
||||
}
|
||||
}
|
||||
.-v-center{
|
||||
&.slide-content-right,
|
||||
&.slide-content-left{
|
||||
.ox-carousel__wrapper{
|
||||
.lib-vendor-prefix-display(flex);
|
||||
.lib-vendor-prefix-flex-wrap();
|
||||
.lib-vendor-box-align(center);
|
||||
align-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.slide-content-2-col{
|
||||
.ox-carousel__row{
|
||||
.lib-vendor-prefix-display(flex);
|
||||
.lib-vendor-box-align(center);
|
||||
align-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
.ox-carousel__col{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin:0 auto;
|
||||
&:first-child{
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px){
|
||||
.ox-carousel {
|
||||
.slide-content-2-col {
|
||||
.ox-carousel__col {
|
||||
-ms-flex: 0 0 50%;
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
height: 100%;
|
||||
margin-right:auto;
|
||||
.lib-vendor-prefix-display(flex);
|
||||
.lib-vendor-box-align(baseline);
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
.ox-carousel__inner{
|
||||
padding:70px;
|
||||
max-width:50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
@media (max-width: 768px){
|
||||
.ox-carousel {
|
||||
.ox-slide-item{
|
||||
&.align-s-center{
|
||||
text-align: center;
|
||||
&.slide-content-2-col .ox-carousel__col:first-child,
|
||||
.ox-carousel__inner{
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
}
|
||||
&.align-s-left{
|
||||
text-align: left;
|
||||
&.slide-content-2-col .ox-carousel__col:first-child,
|
||||
.ox-carousel__inner{
|
||||
margin-left:0;
|
||||
margin-right:auto;
|
||||
}
|
||||
}
|
||||
&.align-s-right{
|
||||
text-align: right;
|
||||
&.slide-content-2-col .ox-carousel__col:first-child,
|
||||
.ox-carousel__inner{
|
||||
margin-left:auto;
|
||||
margin-right:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.mw-50vw{
|
||||
max-width: 50vw!important;
|
||||
width: 100%!important;
|
||||
}
|
||||
.circle-pulse{
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
box-shadow: inset 0px 0px 64px 0px rgba(215,188,167,0.8);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-top:-250px;
|
||||
margin-left:-250px;
|
||||
&.bigger{
|
||||
width: 750px;
|
||||
height: 750px;
|
||||
opacity: 0.85;
|
||||
margin-top:-375px;
|
||||
margin-left:-375px;
|
||||
animation-delay: 40ms;
|
||||
}
|
||||
}
|
||||
.owl-item.active .animate{
|
||||
-webkit-animation-duration: 1000ms;
|
||||
animation-duration: 1000ms;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
.fadeOut {
|
||||
-webkit-animation-name: fadeIn;
|
||||
animation-name: fadeIn;
|
||||
animation-direction: reverse;
|
||||
}
|
||||
|
||||
.fadeIn {
|
||||
-webkit-animation-name: fadeIn;
|
||||
animation-name: fadeIn;
|
||||
}
|
||||
.floating40{
|
||||
animation: floating40 4s infinite;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
.pulseBig{
|
||||
animation: pulseBig 2s infinite;
|
||||
}
|
||||
.circle-pulse-wrapper{
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: scale(0.5);
|
||||
}
|
||||
.circle-pulse-img{
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
padding: 30px;
|
||||
}
|
||||
@-webkit-keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes floating40 {
|
||||
0% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-40px);
|
||||
}
|
||||
}
|
||||
@keyframes pulseBig {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
}
|
||||
100% {
|
||||
transform: scale(5);
|
||||
}
|
||||
}
|
||||
@keyframes pulseBig {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
10% {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
14% {
|
||||
transform: scale(1);
|
||||
}
|
||||
18% {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
40% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
45% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) {
|
||||
.ox-carousel{
|
||||
.ox-slide-item{
|
||||
.title{
|
||||
&.huge-6vw,
|
||||
&.huge-7vw,
|
||||
&.big,
|
||||
&.huge{
|
||||
font-size: 38px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
|
||||
.ox-carousel {
|
||||
.ox-slide-item {
|
||||
.title{
|
||||
&.big{
|
||||
font-size:60px;
|
||||
}
|
||||
&.huge{
|
||||
font-size:72px;
|
||||
}
|
||||
&.huge-6vw{
|
||||
font-size:6.3vw;
|
||||
}
|
||||
&.huge-7vw{
|
||||
font-size:7vw;
|
||||
}
|
||||
&.big,
|
||||
&.huge{
|
||||
line-height: 0.9;
|
||||
margin-left: -4px;
|
||||
}
|
||||
&.huge-6vw,
|
||||
&.huge-7vw{
|
||||
line-height: 0.9;
|
||||
margin-left: -6px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.circle-pulse-wrapper{
|
||||
transform: scale(1);
|
||||
}
|
||||
.circle-pulse-img{
|
||||
top: -25px;
|
||||
right: -25px;
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
|
||||
.ox-carousel {
|
||||
.slide-content-2-col{
|
||||
.ox-carousel__row{
|
||||
.lib-vendor-prefix-flex-wrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
.circle-pulse-wrapper{
|
||||
transform: scale(0.7);
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
|
||||
.ox-carousel {
|
||||
.ox-slide-item {
|
||||
.title{
|
||||
&.big{
|
||||
font-size:72px;
|
||||
}
|
||||
&.huge{
|
||||
font-size: 90px;
|
||||
}
|
||||
}
|
||||
&.margins-big{
|
||||
.subtitle{
|
||||
margin-bottom: 45px;
|
||||
}
|
||||
.title{
|
||||
margin-bottom: 43px;
|
||||
}
|
||||
.subtitle + a.ox-slide__button,
|
||||
.title + a.ox-slide__button{
|
||||
margin-top: 0;
|
||||
}
|
||||
.ox-carousel__col,
|
||||
.ox-carousel__inner{
|
||||
> a.ox-slide__button{
|
||||
margin-top: 47px;
|
||||
}
|
||||
> *:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
& when (@media-common = true) {
|
||||
.ox-carousel {
|
||||
.owl-dots {
|
||||
padding:25px;
|
||||
}
|
||||
&.ox-dots__p-over {
|
||||
.owl-dots {
|
||||
min-height: 70px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding:0 25px;
|
||||
}
|
||||
&.ox-dots__overlay{
|
||||
.ox-slide-item{
|
||||
position:relative;
|
||||
&:before{
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: linear-gradient(to top, rgba(0, 0, 0, 0.25) 10%, rgba(0, 0, 0, 0) 100%);
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-dots__p-right{
|
||||
&.ox-dots__overlay{
|
||||
.ox-slide-item{
|
||||
position:relative;
|
||||
&:before{
|
||||
content: '';
|
||||
height: 100%;
|
||||
width: 250px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(to left, rgba(0, 0, 0, 0.25) 10%, rgba(0, 0, 0, 0) 100%);
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-dots__s-lines_text_full,
|
||||
&.ox-dots__s-lines_text_big,
|
||||
&.ox-dots__s-lines_text {
|
||||
.owl-dots {
|
||||
.owl-dot.active{
|
||||
button.dot {
|
||||
span {
|
||||
&.title {
|
||||
opacity:1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
button.dot {
|
||||
z-index: 2;
|
||||
margin: 0px 16px;
|
||||
|
||||
&:hover span {
|
||||
&.title {
|
||||
background: none;
|
||||
opacity:1;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
&.title {
|
||||
color:#fff;
|
||||
padding: 0 14px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
display: block;
|
||||
margin: 0;
|
||||
text-transform: initial;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
background: none!important;
|
||||
opacity:0.7;
|
||||
font-size:16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ox-dots__s-rounded{
|
||||
.owl-dots {
|
||||
button.owl-dot {
|
||||
&.active{
|
||||
span{
|
||||
width: 10px;
|
||||
}
|
||||
}
|
||||
span{
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-dots__s-lines_vertical{
|
||||
.owl-dots {
|
||||
button.owl-dot {
|
||||
&.active span{
|
||||
width: 47px;
|
||||
height: 12px;
|
||||
}
|
||||
span{
|
||||
width: 47px;
|
||||
height: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-dots__s-lines_full{
|
||||
&.ox-dots__p-over,
|
||||
&.ox-dots__p-bottom{
|
||||
.owl-dots {
|
||||
width: 100%;
|
||||
.lib-vendor-prefix-display(flex);
|
||||
flex-wrap: wrap;
|
||||
.owl-dot {
|
||||
width: 100%;
|
||||
padding:0 18px;
|
||||
}
|
||||
}
|
||||
button.owl-dot {
|
||||
margin-right: 20px;
|
||||
flex: 0 1 100%;
|
||||
&:last-child{
|
||||
margin-right: 0;
|
||||
}
|
||||
&.active{
|
||||
span{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
span{
|
||||
height: 3px;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-dots__s-lines_text_big{
|
||||
.owl-dots {
|
||||
button.dot span.title{
|
||||
line-height: 22px;
|
||||
font-weight: 600;
|
||||
font-size: 20px;
|
||||
}
|
||||
.owl-dot {
|
||||
width: 100%;
|
||||
padding:0 25px;
|
||||
}
|
||||
button.dot span.progress{
|
||||
height: 3px;
|
||||
margin: 16px 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-dots__s-lines_text_full{
|
||||
.owl-dots {
|
||||
width: 100%;
|
||||
.lib-vendor-prefix-display(flex);
|
||||
flex-wrap: wrap;
|
||||
.owl-dot {
|
||||
width: 100%;
|
||||
padding:0 18px;
|
||||
}
|
||||
}
|
||||
&.ox-dots__p-over,
|
||||
&.ox-dots__p-below{
|
||||
.owl-dots {
|
||||
button.dot span.progress{
|
||||
height: 3px;
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
&.ox-dots__a-center{
|
||||
&.ox-dots__p-over,
|
||||
&.ox-dots__p-below{
|
||||
.owl-dots {
|
||||
width: 100%;
|
||||
.lib-vendor-prefix-display(flex);
|
||||
-webkit-justify-content: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
|
||||
.ox-carousel {
|
||||
&.ox-dots__s-lines_text_full,
|
||||
&.ox-dots__s-lines_text_big,
|
||||
&.ox-dots__s-lines_text {
|
||||
.owl-dots {
|
||||
button.dot {
|
||||
margin: 0px 6px;
|
||||
span {
|
||||
&.title {
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-progress__p-nav .owl-dots {
|
||||
min-height: 30px;
|
||||
button.dot span.progress{
|
||||
width: 35px;
|
||||
}
|
||||
}
|
||||
&.ox-dots__p-over.ox-dots__overlay .ox-slide-item:before{
|
||||
height: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
|
||||
.ox-carousel {
|
||||
&.ox-dots__p-right{
|
||||
&.ox-nav__simple{
|
||||
.owl-dots {
|
||||
right: 90px;
|
||||
}
|
||||
}
|
||||
&.nav-big{
|
||||
.owl-dots {
|
||||
right: 70px;
|
||||
}
|
||||
}
|
||||
&.ox-dots__s-lines_text_big{
|
||||
.owl-dots {
|
||||
width: 250px;
|
||||
max-width: 250px;
|
||||
.owl-dot{
|
||||
padding: 0;
|
||||
button.dot{
|
||||
margin: 14px 0 0 auto;
|
||||
span.title{
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.owl-dots {
|
||||
top: 50%;
|
||||
right: 50px;
|
||||
left: auto;
|
||||
width: 200px;
|
||||
max-width: 200px;
|
||||
padding: 0;
|
||||
transform: translateY(-50%);
|
||||
height: auto;
|
||||
bottom: auto;
|
||||
position: absolute;
|
||||
display:block;
|
||||
.owl-dot{
|
||||
width: auto;
|
||||
padding: 0;
|
||||
margin: 14px 0 0 auto;
|
||||
display: block;
|
||||
button{
|
||||
white-space: normal;
|
||||
&.owl-dot {
|
||||
margin: 7px 0 0 auto;
|
||||
position: relative;
|
||||
display: block;
|
||||
width: auto;
|
||||
span{
|
||||
width: 100%;
|
||||
&.title{
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
& when (@media-common = true) {
|
||||
.ox-carousel {
|
||||
.ox-slide-item{
|
||||
> .progress{
|
||||
height: 4px;
|
||||
position:absolute;
|
||||
top:0;
|
||||
bottom:auto;
|
||||
left:0;
|
||||
right:0;
|
||||
z-index: 3;
|
||||
&:before {
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background: #fff;
|
||||
transform-origin: left;
|
||||
transform: scaleX(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-progress__p-bottom{
|
||||
.ox-slide-item{
|
||||
> .progress{
|
||||
top:auto;
|
||||
bottom:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ox-progress__p-nav {
|
||||
.owl-dots {
|
||||
button.dot {
|
||||
&:hover span {
|
||||
&.progress {
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
span {
|
||||
&.progress {
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
display: block;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
margin: 8px 0 0 0;
|
||||
transition: all .2s;
|
||||
position: relative;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background: #fff;
|
||||
transform-origin: left;
|
||||
transform: scaleX(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@keyframes progress-horizontal {
|
||||
from {
|
||||
transform: scaleX(0);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
define( [
|
||||
'jquery',
|
||||
'jquery-ui-modules/widget',
|
||||
'jquery-ui-modules/core',
|
||||
'jquery-ui-modules/effect',
|
||||
'owl.carousel',
|
||||
], function ( $ ) {
|
||||
'use strict';
|
||||
|
||||
$.widget( 'mage.OxCarousel', {
|
||||
options: {
|
||||
// OxCarousel
|
||||
autoScroll: 0,
|
||||
autoplayHoverPause: 0,
|
||||
// Owl.carousel
|
||||
rewind: false,
|
||||
items: 1,
|
||||
slideBy: 1,
|
||||
lazyLoad: true,
|
||||
responsive: {
|
||||
0: {
|
||||
items: 1,
|
||||
},
|
||||
},
|
||||
dotsData: true,
|
||||
dotData: true,
|
||||
dots: true,
|
||||
nav: false,
|
||||
},
|
||||
_create: function () {
|
||||
this.options.autoplayTimeout = parseInt( this.options.autoScroll ) * 1000;
|
||||
this.options.autoplay = 0 < this.options.autoplayTimeout;
|
||||
this.options.autoplayHoverPause = this.options.autoplayHoverPause && this.options.autoplay;
|
||||
this._dots(this);
|
||||
var options = this._createOptions();
|
||||
this.element.owlCarousel( options );
|
||||
},
|
||||
|
||||
_createOptions: function () {
|
||||
var _self = this;
|
||||
var options = {
|
||||
onInitialize: function () {
|
||||
|
||||
},
|
||||
onInitialized: function () {
|
||||
_self._resizeSlides(this.$element, this);
|
||||
_self._afterMove(this.$element);
|
||||
//_self.progressDots (this );
|
||||
$(document.body).trigger('contentUpdated.oxlazy');
|
||||
},
|
||||
onRefresh: function () {
|
||||
|
||||
},
|
||||
onRefreshed: function () {
|
||||
_self._resizeSlides( this.$element, this );
|
||||
_self._afterMove( this.$element );
|
||||
},
|
||||
onChanged: function () {
|
||||
//_self.progressDots( this );
|
||||
_self._afterMove( this );
|
||||
}
|
||||
};
|
||||
|
||||
return $.extend( { }, options, this.options );
|
||||
|
||||
},
|
||||
_afterMove: function ( $this ) {
|
||||
|
||||
},
|
||||
_dots: function ($this) {
|
||||
var $wraper = this.element.closest( '.ox-carousel' ).eq( 0 );
|
||||
$wraper.on( 'click', 'div.owl-dot', function () {
|
||||
$this.element.trigger( 'to.owl.carousel', [$(this).index(), 300]);
|
||||
$( '.owl-dot' ).removeClass( 'active' );
|
||||
$(this).addClass( 'active' );
|
||||
});
|
||||
},
|
||||
_resizeSlides: function ( $this, owl ) {
|
||||
|
||||
},
|
||||
|
||||
progressDots: function( $this ) {
|
||||
if (!this.options.dots || !this.options.autoplay || !this.options.progress) {
|
||||
return;
|
||||
}
|
||||
var anim = this.options.autoplayTimeout + 'ms linear 0s 1 normal forwards running progress-horizontal',
|
||||
$wrapper = $this.$element.closest( '.ox-banners-slider__container' ).eq( 0 ),
|
||||
$dot = $wrapper.find('.owl-dot').find('.progress'),
|
||||
$dotActive = $wrapper.find('.owl-dot.active'),
|
||||
$dotProgress = $dotActive.find('.progress');
|
||||
$dot.css(''); //reset it
|
||||
setTimeout(function(){
|
||||
$dotProgress.css('animation', anim); //set it back
|
||||
});
|
||||
},
|
||||
|
||||
} );
|
||||
|
||||
return $.mage.OxCarousel;
|
||||
} );
|
||||
Reference in New Issue
Block a user