Append ES specifics fields into the attribute edit store front tab.

@param Front    $subject The StoreFront tab
@param \Closure $proceed The parent function
@param Form     $form    The form

@return Front
198889
public function aroundSetForm(Front $subject, \Closure $proceed, Form $form)
    {
        $block = $proceed($form);

        $fieldset = $this->createFieldset($form, $subject);

        $this->moveOrginalFields($form);
        $this->addSearchFields($fieldset);
        $this->addAutocompleteFields($fieldset);
        $this->addFacetFields($fieldset);
        $this->addSortFields($fieldset);
        $this->appendSliderDisplayRelatedFields($form, $subject);

        if ($this->getAttribute()->getAttributeCode() == 'name') {
            $form->getElement('is_searchable')->setDisabled(1);
        }

        $this->appendFieldsDependency($subject);

        return $block;
    }
1220389
public function aroundGetProductDetailsHtml(
        \Magento\Catalog\Block\Product\ListProduct $subject,
        \Closure $proceed,
        \Magento\Catalog\Model\Product $product
    ) {
        $result = $proceed($product);

        $deliveryBlock = $subject->getLayout()->getBlock('product.info.delivery');

        if ($deliveryBlock) {
            $deliveryBlock->setProduct($product);

            if ((bool) $this->_scopeConfig->getValue(
                'catalog/frontend/display_delivery_time',
                \Magento\Store\Model\ScopeInterface::SCOPE_STORE
            )) {
                $result = $deliveryBlock->toHtml() . $result;
            }
        }
        return $result;
    }
709824
public function aroundGetStockItem(
        \Magento\CatalogInventory\Model\StockRegistryProvider $subject,
        \Closure $proceed,
        $productId,
        $scopeId
    ) {
        // $result = $proceed($productId, $scopeId); // original method will create empty item for stock registry
        $result = $this->storeStockRegistry->getStockItem($productId, $scopeId);
        if (null === $result) {
            $criteria = $this->factStockItemCrit->create();
            $criteria->setProductsFilter($productId);
            $stockId = $this->manStock->getCurrentStockId();
            $criteria->setStockFilter($stockId);
            $collection = $this->daoStockItem->getList($criteria);
            $result = current($collection->getItems());
            if ($result && $result->getItemId()) {
                $this->storeStockRegistry->setStockItem($productId, $scopeId, $result);
            } else {
                $result = $this->factStockItem->create();
            }
        }
        return $result;
    }
134101
public function aroundGetExcludes(
        \Magento\Framework\View\Asset\Minification $subject,
        callable $proceed,
        $contentType
    ) {
        $result = $proceed($contentType);

        //Content type can be css or js
        if ($contentType == 'js') {
            $result[] = 'trackedlink.net/_dmpt.js';
            $result[] = 'trackedlink.net/_dmmpt.js';
        }

        return $result;
    }
32338
public static function form_policydoc_add(stdClass $form) {
        global $DB;

        $form = clone($form);

        $form->policyid = $DB->insert_record('tool_policy', (object) [
            'sortorder' => 999,
        ]);

        static::distribute_policy_document_sortorder();

        return static::form_policydoc_update_new($form);
    }
385212
public function aroundProcessRelation(
        \Magento\Quote\Model\Quote\Relation $subject,
        \Closure $proceed,
        \Magento\Framework\Model\AbstractModel $object
    ) {
        $proceed($object);
        assert($object instanceof \Magento\Quote\Model\Quote);
        $quoteId = $object->getId();
        /** @var \Magento\Quote\Model\Quote\Address $addrShipping */
        $addrShipping = $object->getShippingAddress();
        $total = $addrShipping->getData(\Praxigento\Wallet\Model\Quote\Address\Total\Partial::CODE_TOTAL);
        $baseTotal = $addrShipping->getData(\Praxigento\Wallet\Model\Quote\Address\Total\Partial::CODE_BASE_TOTAL);
        /* check if current total exist */
        /** @var \Praxigento\Wallet\Repo\Data\Partial\Quote $exist */
        $exist = $this->daoPartialQuote->getById($quoteId);
        if ($exist) {
            /* there is record in registry */
            $baseTotalExist = $exist->getBasePartialAmount();
            if ($baseTotalExist == $baseTotal) {
                /* amount is equal to stored, do nothing */
            } elseif (abs($baseTotal) < Cfg::DEF_ZERO) {
                /* amount is zero, remove data from registry */
                $this->daoPartialQuote->deleteById($quoteId);
            } else {
                /* update saved value */
                $exist->setPartialAmount($total);
                $exist->setBasePartialAmount($baseTotal);
                $this->daoPartialQuote->updateById($quoteId, $exist);
            }
        } elseif (abs($baseTotal) > Cfg::DEF_ZERO) {
            /* create new record in registry */
            $baseCurr = $object->getBaseCurrencyCode();
            $curr = $object->getQuoteCurrencyCode();
            $data = new \Praxigento\Wallet\Repo\Data\Partial\Quote();
            $data->setQuoteRef($quoteId);
            $data->setPartialAmount($total);
            $data->setCurrency($curr);
            $data->setBasePartialAmount($baseTotal);
            $data->setBaseCurrency($baseCurr);
            $this->daoPartialQuote->create($data);
        }
    }
956632
public function handleForm(Request $request,Form $form){
        // The JSON PUT data will include all attributes in the entity, even
        // those that are not updateable by the user and are not in the form.
        // We need to remove these extra fields or we will get a
        // "This form should not contain extra fields" Form Error
        $data = $request->request->all();
        $children = $form->all();
        //Eliminamos los datos del request que no pertenecen al formulario
        $data = array_intersect_key($data, $children);
        $form->submit($data);
        return $form;
    }
1256024
public function aroundAddOrder(
        \Magento\Catalog\Model\ResourceModel\Product\Collection $subject,
        \Closure $proceed,
        $field,
        $dir = \Magento\Framework\Data\Collection::SORT_ORDER_DESC
    ) {
        if (CollectionFactory::A_PV_PRODUCT == $field) {
            /* map joined attribute to composite pair "tableAlias.field" */
            $result = $subject;
            $order = CollectionFactory::FQN_PV . ' ' . $dir;
            $select = $result->getSelect();
            $select->order($order);
        } else {
            /* proceed others Magento attributes as-is */
            $result = $proceed($field, $dir);
        }
        return $result;
    }
559433
public function aroundGetProductPrice(
        \Magento\Catalog\Block\Product\ListProduct $subject,
        \Closure $proceed,
        \Magento\Catalog\Model\Product $product
    ) {
        $result = $proceed($product);
        $canSeePv = $this->hlpCust->canSeePv();
        if ($canSeePv) {
            $domId = "prxgt_pv_" . $product->getId();
            $pvProd = $product->getData(AProdCollFactory::A_PV_PRODUCT);
            $pvProd = $this->hlpFormat->toNumber($pvProd);
            $html = "<div id=\"$domId\"><span>$pvProd</span> PV</div>";
            $result = $html . $result;
        }
        return $result;
    }
1038174
private function successRedirect(FormInterface $form, $entity)
    {
        foreach ($form->all() as $name => $child) {
            if ($child instanceof ClickableInterface && $child->isClicked() && isset(self::$submitButtonRedirects[$name])) {
                return $this->redirect(
                    $this->getAdminRouter()->generate($entity, $this->entityClass, self::$submitButtonRedirects[$name])
                );
            }
        }

        return $this->redirect($this->getAdminRouter()->generate($entity, $this->entityClass, AdminRouter::TYPE_EDIT));
    }
637779
public function aroundSave(
        \Magento\Quote\Model\ResourceModel\Quote\Item $subject,
        \Closure $proceed,
        \Magento\Quote\Model\Quote\Item $object
    ) {
        $result = $proceed($object);
        $isDeleted = $object->isDeleted();
        if (!$isDeleted) {
            $id = $object->getId();
            $qty = $object->getQty();
            $product = $object->getProduct();
            $productId = $product->getId();
            $pvWrhs = $this->hlpGetPv->product($productId);
            $subtotal = $this->hlpFormat->toNumber($pvWrhs * $qty);
            /* create/update PV values for quote item (if changed) */
            $pk = [EPvQuoteItem::A_ITEM_REF => $id];
            $found = $this->daoPvQuoteItem->getById($pk);
            if ($found) {
                /* update PV data if subtotals are different */
                if ($found->getSubtotal() != $subtotal) {
                    /* we don't know discount for the item */
                    $found->setSubtotal($subtotal);
                    $found->setDiscount(0);
                    $found->setTotal($subtotal);
                    $this->daoPvQuoteItem->updateById($pk, $found);
                }
            } else {
                /* create new record */
                $entity = new EPvQuoteItem();
                $entity->setItemRef($id);
                /* we don't know discount for the item */
                $entity->setSubtotal($subtotal);
                $entity->setDiscount(0);
                $entity->setTotal($subtotal);
                $this->daoPvQuoteItem->create($entity);
            }
        }
        return $result;
    }
833213
protected function _ensureSuccess(Subject $subject)
    {
        $controller = $this->_controller();

        if (isset($controller->viewVars['success'])) {
            return;
        }

        $controller->set('success', $subject->success);
    }
77008
public function updateEditAccountForm($form)
    {
        // Add company name field
        $company_field = TextField::create(
            "Company",
            _t('CheckoutUsers.Company', "Company")
        );
        $company_field->setRightTitle(_t("Checkout.Optional", "Optional"));
        $form->Fields()->insertBefore($company_field, "FirstName");

        // Add contact phone number field
        $phone_field = TextField::create(
            "PhoneNumber",
            _t("CheckoutUsers.PhoneNumber", "Phone Number")
        );
        $phone_field->setRightTitle(_t("Checkout.Optional", "Optional"));
        $form->Fields()->add($phone_field);
    }
741022
public function aroundGetSelectCountSql(
        \Magento\Catalog\Model\ResourceModel\Product\Collection $subject,
        \Closure $proceed
    ) {
        /** @var \Magento\Framework\DB\Select $result */
        $result = $proceed();
        $result->reset(\Zend_Db_Select::GROUP);
        return $result;
    }
755763
public function update(\Tripod\Mongo\ImpactedSubject $subject)
    {
        $resource = $subject->getResourceId();
        $resourceUri    = $resource[_ID_RESOURCE];
        $context        = $resource[_ID_CONTEXT];

        $this->generateViews(array($resourceUri),$context);
    }
1035385
public function afterGetVariables(\Magento\Email\Block\Adminhtml\Template\Edit\Form $subject, $result)
    {
        $additionalConfigValues = $this->variables->getAdditionalConfigVariables();
        $optionArray = [];
        foreach ($additionalConfigValues as $variable) {
            $optionArray[] = [
                'value' => '{{config path="' . $variable['value'] . '"}}',
                'label' => $variable['label'],
            ];
        }
        if ($optionArray) {
            $result[] = [
                'label' => __('Imprint'),
                'value' => $optionArray,
            ];
        }
        return $result;
    }
1220256
protected function validateForm($form, $data = null, $scenario = null) {
		if(is_string($form) || is_array($form)) {
			$form = Yii::createObject($form);
		}
		/** @var \yii\base\Model $form */
		if(!empty($data)) {
			Yii::configure($form, $data);
		}
		if(!empty($scenario)) {
			$form->scenario = $scenario;
		}
		if(!$form->validate()) {
			throw new UnprocessableEntityHttpException($form);
		}
		return $form->getAttributes();
	}