Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-braintree
Observer
AddPaypalShortcuts.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Observer
;
7
8
use
Magento\Framework\Event\Observer
;
9
use
Magento\Catalog\Block\ShortcutButtons
;
10
use
Magento\Framework\Event\ObserverInterface
;
11
15
class
AddPaypalShortcuts
implements
ObserverInterface
16
{
20
const
PAYPAL_SHORTCUT_BLOCK
= \Magento\Braintree\Block\Paypal\Button::class;
21
28
public
function
execute
(
Observer
$observer
)
29
{
30
// Remove button from catalog pages
31
if
(
$observer
->getData(
'is_catalog_product'
)) {
32
return
;
33
}
34
36
$shortcutButtons =
$observer
->getEvent()->getContainer();
37
38
$shortcut = $shortcutButtons->getLayout()->createBlock(self::PAYPAL_SHORTCUT_BLOCK);
39
40
$shortcutButtons->addShortcut($shortcut);
41
}
42
}
Magento\Catalog\Block\ShortcutButtons
Definition:
ShortcutButtons.php:18
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
Magento\Braintree\Observer
Definition:
AddPaypalShortcuts.php:6
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento\Framework\Event\Observer
Definition:
Collection.php:12
Magento\Braintree\Observer\AddPaypalShortcuts\PAYPAL_SHORTCUT_BLOCK
const PAYPAL_SHORTCUT_BLOCK
Definition:
AddPaypalShortcuts.php:20
Magento\Framework\Event\ObserverInterface\execute
execute(Observer $observer)
Magento\Braintree\Observer\AddPaypalShortcuts
Definition:
AddPaypalShortcuts.php:15
Magento\Framework\Event\Observer
Definition:
Observer.php:14