idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
43,600 | protected static function getBigger ( array $ values ) { $ bigger = null ; foreach ( $ values as $ value => $ repeat ) { if ( $ bigger === null || $ repeat > $ values [ $ bigger ] ) { $ bigger = $ value ; } } return $ bigger ; } | Returns the key of the bigger value in an array |
43,601 | protected function getFirstFromProviders ( callable $ callable , $ default = null ) { $ values = array_filter ( array_map ( $ callable , $ this -> providers ) ) ; return empty ( $ values ) ? $ default : current ( $ values ) ; } | Returns the first value of the providers |
43,602 | protected function getAllFromProviders ( callable $ callable ) { $ values = array_filter ( array_map ( $ callable , $ this -> providers ) ) ; $ all = [ ] ; foreach ( $ values as $ value ) { foreach ( $ value as $ v ) { if ( ! in_array ( $ v , $ all , true ) ) { $ all [ ] = $ v ; } } } return $ all ; } | Returns the all values from the providers |
43,603 | protected function exec ( Url $ url , array $ options ) { $ connection = curl_init ( ( string ) $ url ) ; curl_setopt_array ( $ connection , $ options ) ; $ curl = new CurlResult ( $ connection ) ; $ curl -> onHeader ( function ( $ name , $ value , $ data ) { if ( $ name === 'content-type' ) { $ data -> isBinary = ! pr... | Execute a curl request |
43,604 | public static function create ( $ url , array $ config = null , DispatcherInterface $ dispatcher = null ) { if ( ! ( $ url instanceof Url ) ) { $ url = Url :: create ( $ url ) ; } if ( $ config === null ) { $ config = self :: $ default_config ; } else { $ config += self :: $ default_config ; } if ( $ dispatcher === nul... | Gets the info from an url . |
43,605 | private static function process ( Url $ url , array $ config , DispatcherInterface $ dispatcher ) { $ response = $ dispatcher -> dispatch ( $ url ) ; $ adapter = self :: getClass ( 'File' , $ config ) ; if ( $ adapter :: check ( $ response ) ) { return new $ adapter ( $ response , $ config , $ dispatcher ) ; } $ adapte... | Process the url . |
43,606 | private static function getClass ( $ name , array $ config ) { if ( ! empty ( $ config [ 'custom_adapters_namespace' ] ) ) { $ namespaces = ( array ) $ config [ 'custom_adapters_namespace' ] ; foreach ( $ namespaces as $ namespace ) { $ class = $ namespace . $ name ; if ( class_exists ( $ class ) ) { return $ class ; }... | Returns a class name using the custom_adapters_namespace |
43,607 | private static function imageIsValid ( Url $ url , Url $ baseUrl , $ externalImages ) { if ( $ url -> getContent ( ) !== null || $ url -> getDomain ( ) === $ baseUrl -> getDomain ( ) ) { return true ; } return is_bool ( $ externalImages ) ? $ externalImages : $ url -> match ( $ externalImages ) ; } | Check whether a image url is valid or not . |
43,608 | public function isValid ( array $ codes = null ) { if ( $ codes === null ) { return $ this -> statusCode === 200 ; } return in_array ( $ this -> statusCode , $ codes ) ; } | Check if the response is valid or not . |
43,609 | public function add_to_context ( $ context ) { $ context [ 'foo' ] = 'bar' ; $ context [ 'stuff' ] = 'I am a value set in your functions.php file' ; $ context [ 'notes' ] = 'These values are available everytime you call Timber::context();' ; $ context [ 'menu' ] = new Timber \ Menu ( ) ; $ context [ 'site' ] = $ this ;... | This is where you add some context |
43,610 | public function add_to_twig ( $ twig ) { $ twig -> addExtension ( new Twig_Extension_StringLoader ( ) ) ; $ twig -> addFilter ( new Twig_SimpleFilter ( 'myfoo' , array ( $ this , 'myfoo' ) ) ) ; return $ twig ; } | This is where you can add your own functions to twig . |
43,611 | protected function _preparePage ( ) { parent :: _preparePage ( ) ; $ this -> getColumnSet ( ) -> getChildBlock ( 'store_id' ) -> setFilterConditionCallback ( [ $ this , 'filterStoreCondition' ] ) ; $ this -> getColumnSet ( ) -> getChildBlock ( 'thesaurus_terms_summary' ) -> setFilterConditionCallback ( [ $ this , 'filt... | Append custom filter for Store Id |
43,612 | protected function filterStoreCondition ( $ collection , $ column ) { if ( ! ( $ value = $ column -> getFilter ( ) -> getValue ( ) ) ) { return ; } $ collection -> addStoreFilter ( $ value ) ; } | Apply store filter |
43,613 | protected function filterTermsCondition ( $ collection , $ column ) { if ( ! ( $ value = $ column -> getFilter ( ) -> getValue ( ) ) ) { return ; } $ collection -> setTermFilter ( $ value ) ; } | Apply term filter |
43,614 | public function getValue ( $ path = null , $ scope = ScopeConfigInterface :: SCOPE_TYPE_DEFAULT , $ scopeCode = null ) { return $ this -> scopePool -> getScope ( $ scope , $ scopeCode ) -> getValue ( $ path ) ; } | Retrieve config value by path and scope |
43,615 | public function execute ( $ ids ) { $ storeIds = array_keys ( $ this -> storeManager -> getStores ( ) ) ; foreach ( $ storeIds as $ storeId ) { $ dimension = $ this -> dimensionFactory -> create ( [ 'name' => 'scope' , 'value' => $ storeId ] ) ; $ this -> indexerHandler -> deleteIndex ( [ $ dimension ] , new \ ArrayObj... | Execute materialization on ids entities |
43,616 | public function executeFull ( ) { $ storeIds = array_keys ( $ this -> storeManager -> getStores ( ) ) ; foreach ( $ storeIds as $ storeId ) { $ dimension = $ this -> dimensionFactory -> create ( [ 'name' => 'scope' , 'value' => $ storeId ] ) ; $ this -> indexerHandler -> cleanIndex ( [ $ dimension ] ) ; $ this -> index... | Execute full indexation |
43,617 | public function reindex ( $ storeId , $ synonyms , $ expansions ) { $ indexIdentifier = ThesaurusIndex :: INDEX_IDENTIER ; $ indexName = $ this -> indexSettingsHelper -> createIndexNameFromIdentifier ( $ indexIdentifier , $ storeId ) ; $ indexAlias = $ this -> indexSettingsHelper -> getIndexAliasFromIdentifier ( $ inde... | Create the synonyms index for a store id . |
43,618 | private function getIndexSettings ( $ synonyms , $ expansions ) { $ settings = [ 'number_of_shards' => $ this -> indexSettingsHelper -> getNumberOfShards ( ) , 'number_of_replicas' => $ this -> indexSettingsHelper -> getNumberOfReplicas ( ) , 'requests.cache.enable' => true , ] ; $ settings [ 'analysis' ] [ 'filter' ] ... | Returns index settings . |
43,619 | private function addAnalyzerSettings ( $ settings , $ type , $ values ) { $ settings [ 'analysis' ] [ 'analyzer' ] [ $ type ] = [ 'tokenizer' => 'whitespace' , 'filter' => [ 'lowercase' , 'shingle' ] , ] ; if ( ! empty ( $ values ) ) { $ values = $ this -> prepareSynonymFilterData ( $ values ) ; $ settings [ 'analysis'... | Append an analyzer for a thesaurus to existing settings . |
43,620 | public function setStoreId ( $ store ) { if ( $ store instanceof Store ) { $ store = $ store -> getId ( ) ; } $ this -> storeId = $ store ; return $ this ; } | Set Store ID for filter |
43,621 | public function addSearchContainersFilter ( $ searchContainers ) { if ( ! is_array ( $ searchContainers ) ) { $ searchContainers = [ $ searchContainers ] ; } $ cond = OptimizerInterface :: TABLE_NAME_SEARCH_CONTAINER . '.' . OptimizerInterface :: OPTIMIZER_ID . ' = main_table.' . OptimizerInterface :: OPTIMIZER_ID ; $... | Add search containers filer . |
43,622 | public function addIsActiveFilter ( $ date = null ) { $ this -> addFieldToFilter ( 'is_active' , true ) ; if ( $ date == null ) { $ date = $ this -> date -> date ( 'Y-m-d' ) ; } $ this -> getSelect ( ) -> where ( 'from_date is null or from_date <= ?' , $ date ) -> where ( 'to_date is null or to_date >= ?' , $ date ) ; ... | Returns only active optimizers . |
43,623 | protected function getFieldFormat ( ) { $ format = $ this -> localeFormat -> getPriceFormat ( ) ; $ attribute = $ this -> getFilter ( ) -> getAttributeModel ( ) ; $ format [ 'pattern' ] = ( string ) $ attribute -> getDisplayPattern ( ) ; $ format [ 'precision' ] = ( int ) $ attribute -> getDisplayPrecision ( ) ; $ form... | Retrieve Field Format for slider display |
43,624 | private function getCurrentValue ( ) { $ currentValue = $ this -> getFilter ( ) -> getCurrentValue ( ) ; if ( ! is_array ( $ currentValue ) ) { $ currentValue = [ ] ; } if ( ! isset ( $ currentValue [ 'from' ] ) || $ currentValue [ 'from' ] === '' ) { $ currentValue [ 'from' ] = $ this -> getMinValue ( ) ; } if ( ! iss... | Returns values currently selected by the user . |
43,625 | private function getIntervals ( ) { $ intervals = [ ] ; foreach ( $ this -> getFilter ( ) -> getItems ( ) as $ item ) { $ intervals [ ] = [ 'value' => $ item -> getValue ( ) , 'count' => $ item -> getCount ( ) ] ; } return $ intervals ; } | Return available intervals . |
43,626 | private function getUrlTemplate ( ) { $ filter = $ this -> getFilter ( ) ; $ item = current ( $ this -> getFilter ( ) -> getItems ( ) ) ; $ regexp = "/({$filter->getRequestVar()})=(-?[0-9]+)/" ; $ replacement = '${1}=<%- from %>-<%- to %>' ; return preg_replace ( $ regexp , $ replacement , $ item -> getUrl ( ) ) ; } | Retrieve filter URL template with placeholders for range . |
43,627 | public function createRelevanceConfigTable ( SchemaSetupInterface $ setup ) { $ connection = $ setup -> getConnection ( ) ; $ table = $ connection -> newTable ( $ setup -> getTable ( 'smile_elasticsuite_relevance_config_data' ) ) -> addColumn ( 'config_id' , \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_INTEGER , nu... | Create Relevance Config table . |
43,628 | public function getById ( $ optimizerId ) { if ( ! isset ( $ this -> optimizerRepositoryById [ $ optimizerId ] ) ) { $ optimizerModel = $ this -> optimizerFactory -> create ( ) ; $ optimizer = $ this -> entityManager -> load ( $ optimizerModel , $ optimizerId ) ; if ( ! $ optimizer -> getId ( ) ) { throw NoSuchEntityEx... | Retrieve a optimizer by its ID |
43,629 | public function save ( \ Smile \ ElasticsuiteCatalogOptimizer \ Api \ Data \ OptimizerInterface $ optimizer ) { try { $ this -> entityManager -> save ( $ optimizer ) ; } catch ( \ Exception $ exception ) { throw new CouldNotSaveException ( __ ( 'Could not save the optimizer: %1' , $ exception -> getMessage ( ) ) ) ; } ... | save a optimizer |
43,630 | public function delete ( \ Smile \ ElasticsuiteCatalogOptimizer \ Api \ Data \ OptimizerInterface $ optimizer ) { $ optimizerId = $ optimizer -> getId ( ) ; $ this -> entityManager -> delete ( $ optimizer ) ; if ( isset ( $ this -> optimizerRepositoryById [ $ optimizerId ] ) ) { unset ( $ this -> optimizerRepositoryByI... | delete a optimizer |
43,631 | private function prepareProductCollection ( ProductCollection $ collection ) { foreach ( $ this -> collectionProcessors as $ processor ) { $ collection = $ processor -> prepareCollection ( $ collection ) ; } return $ collection ; } | Init suggested products collection . |
43,632 | public function saveCache ( $ cacheKey , $ data , $ cacheTags = [ ] , $ lifetime = self :: DEFAULT_LIFETIME ) { $ this -> localCache [ $ cacheKey ] = $ data ; if ( ! is_string ( $ data ) ) { $ data = serialize ( $ data ) ; } $ this -> cache -> save ( $ data , $ cacheKey , $ cacheTags , $ lifetime ) ; } | Save some data into an index cache . |
43,633 | public function loadCache ( $ cacheKey ) { if ( ! isset ( $ this -> localCache [ $ cacheKey ] ) ) { $ data = $ this -> cache -> load ( $ cacheKey ) ; if ( $ data ) { $ data = unserialize ( $ data ) ; } $ this -> localCache [ $ cacheKey ] = $ data ; } return $ this -> localCache [ $ cacheKey ] ; } | Load data from the cache |
43,634 | public function cleanIndexCache ( $ indexIdentifier , $ storeId ) { $ cacheTags = $ this -> getCacheTags ( $ indexIdentifier , $ storeId ) ; $ this -> localCache = [ ] ; $ this -> cache -> clean ( $ cacheTags ) ; } | Clean the cache by index identifier and store . |
43,635 | public function getJsConfig ( ) { $ config = [ 'dateFormat' => $ this -> getDateFormat ( ) , 'from' => [ 'id' => $ this -> getJsId ( 'date-range-picker' , 'from' ) ] , 'to' => [ 'id' => $ this -> getJsId ( 'date-range-picker' , 'to' ) ] , ] ; $ dateBounds = $ this -> indexManager -> getIndicesDateBounds ( \ Smile \ Ela... | Get JS config |
43,636 | public function getAttributesRawData ( $ storeId , array $ entityIds , $ tableName , array $ attributeIds ) { $ select = $ this -> connection -> select ( ) ; $ linkField = $ this -> getEntityMetaData ( $ this -> getEntityTypeId ( ) ) -> getLinkField ( ) ; $ entityIdField = $ this -> getEntityMetaData ( $ this -> getEnt... | Load attribute data for a list of entity ids . |
43,637 | protected function applyCategoryFilterToCollection ( \ Magento \ Catalog \ Api \ Data \ CategoryInterface $ category ) { $ this -> getLayer ( ) -> getProductCollection ( ) -> addCategoryFilter ( $ category ) ; return $ this ; } | Apply the category filter to the layer product collection . |
43,638 | protected function getChildrenCategories ( ) { if ( $ this -> childrenCategories === null ) { $ currentCategory = $ this -> dataProvider -> getCategory ( ) ; $ this -> childrenCategories = $ currentCategory -> getChildrenCategories ( ) ; } return $ this -> childrenCategories ; } | Retrieve currently selected category children categories . |
43,639 | public function afterGetCurrentCategory ( \ Magento \ Catalog \ Model \ Layer \ Category $ layer , \ Magento \ Catalog \ Api \ Data \ CategoryInterface $ category ) { $ this -> searchContext -> setCurrentCategory ( $ category ) ; return $ category ; } | Set the current layer category into the Search context after being assigned to the layer . |
43,640 | public function addProducts ( $ productIds ) { $ fullTextIndexer = $ this -> indexerRegistry -> get ( \ Magento \ CatalogSearch \ Model \ Indexer \ Fulltext :: INDEXER_ID ) ; $ indexerChangeLog = $ fullTextIndexer -> getView ( ) -> getChangelog ( ) ; $ changelogTableName = $ indexerChangeLog -> getName ( ) ; $ columnNa... | Add products to the fulltext indexer changelog table |
43,641 | private function createDateFromText ( $ text ) { try { $ date = new \ DateTime ( $ text ) ; } catch ( \ Exception $ e ) { $ date = new \ DateTime ( self :: DEFAULT_TO_DATE ) ; } return $ date -> format ( 'Y-m-d' ) ; } | Convert a DateTime compatible date or expression into an ES compatible date format |
43,642 | public function getContainerCode ( ) { if ( ! $ this -> hasData ( 'container_code' ) ) { $ this -> setData ( 'container_code' , $ this -> getRequest ( ) -> getParam ( $ this -> getContainerVarName ( ) ) ) ; } return $ this -> getData ( 'container_code' ) ; } | Retrieve container code |
43,643 | public function getStoreId ( ) { if ( ! $ this -> hasData ( 'store_id' ) ) { $ this -> setData ( 'store_id' , ( int ) $ this -> getRequest ( ) -> getParam ( $ this -> getStoreVarName ( ) ) ) ; } return $ this -> getData ( 'store_id' ) ; } | Retrieve Store Id |
43,644 | public function getSwitchUrl ( ) { if ( $ url = $ this -> getData ( 'switch_url' ) ) { return $ url ; } return $ this -> getUrl ( '*/*/*' , [ '_current' => true , $ this -> getStoreVarName ( ) => null , $ this -> getStoreGroupVarName ( ) => null , $ this -> getContainerVarName ( ) => null , ] ) ; } | Retrieve switch url |
43,645 | public function getCurrentSelectionName ( ) { $ name = $ this -> getDefaultSelectionName ( ) ; if ( $ this -> getCurrentContainerName ( ) ) { $ name = $ this -> getCurrentContainerLabel ( ) ; if ( $ this -> getCurrentStoreName ( ) ) { $ name .= " > " . $ this -> getCurrentStoreName ( ) ; } } return $ name ; } | Get current selection name |
43,646 | public function getCurrentStoreName ( ) { if ( $ this -> getStoreId ( ) !== null ) { $ store = $ this -> storeFactory -> create ( ) ; $ store -> load ( $ this -> getStoreId ( ) ) ; if ( $ store -> getId ( ) ) { return $ store -> getName ( ) ; } } } | Get current store view name |
43,647 | public function isFullText ( $ container ) { $ fulltext = false ; if ( isset ( $ container [ 'fulltext' ] ) ) { $ fulltext = filter_var ( $ container [ 'fulltext' ] , FILTER_VALIDATE_BOOLEAN ) ; } return $ fulltext ; } | Check if container is used for fulltext queries |
43,648 | public function apply ( \ Magento \ Framework \ App \ RequestInterface $ request ) { $ filter = $ request -> getParam ( $ this -> getRequestVar ( ) ) ; if ( $ filter && ! is_array ( $ filter ) ) { $ filterParams = explode ( ',' , $ filter ) ; $ filter = $ this -> dataProvider -> validateFilter ( $ filterParams [ 0 ] ) ... | Apply price range filter |
43,649 | private function getCoverageRates ( $ storeId , $ requestName , $ query = null , $ filters = [ ] , $ queryFilters = [ ] ) { $ coverageRequest = $ this -> coverageRequestBuilder -> create ( $ storeId , $ requestName , 0 , 0 , $ query , [ ] , $ filters , $ queryFilters ) ; $ coverage = $ this -> coverageProviderFactory -... | Get coverage rate of attributes for current search request . |
43,650 | public function getProductPositions ( $ categoryId , $ storeId ) { $ select = $ this -> getBaseSelect ( ) -> where ( 'category_id = ?' , ( int ) $ categoryId ) -> where ( 'store_id = ?' , ( int ) $ storeId ) -> where ( 'position IS NOT NULL' ) -> columns ( [ 'product_id' , 'position' ] ) ; return $ this -> getConnectio... | Get product positions for a given categoryId and Store Id . |
43,651 | public function getProductBlacklist ( $ categoryId , $ storeId ) { $ select = $ this -> getBaseSelect ( ) -> columns ( [ 'product_id' ] ) -> where ( 'category_id = ?' , ( int ) $ categoryId ) -> where ( 'store_id = ?' , ( int ) $ storeId ) -> where ( 'is_blacklisted = ?' , ( int ) true ) ; return $ this -> getConnectio... | Get product blacklist for a given categoryId and Store Id . |
43,652 | public function getProductPositionsByCategory ( $ category ) { $ storeId = \ Magento \ Store \ Model \ Store :: DEFAULT_STORE_ID ; if ( is_object ( $ category ) ) { if ( $ category -> getUseStorePositions ( ) ) { $ storeId = $ category -> getStoreId ( ) ; } $ category = $ category -> getId ( ) ; } return $ this -> getP... | Load product positions for the given category . |
43,653 | private function getBaseSelect ( ) { $ select = $ this -> getConnection ( ) -> select ( ) ; $ select -> from ( [ 'main_table' => $ this -> getMainTable ( ) ] , [ ] ) ; return $ select ; } | Init a base select with the main table . |
43,654 | public function afterGetProductCollection ( \ Magento \ Catalog \ Model \ Rss \ Category $ dataProvider , \ Magento \ Catalog \ Model \ ResourceModel \ Product \ Collection $ collection , \ Magento \ Catalog \ Model \ Category $ category , $ storeId ) { $ collection -> addFieldToFilter ( 'category_ids' , $ this -> getC... | Apply category filter to the collection |
43,655 | private function getCategoryFilterParam ( \ Magento \ Catalog \ Model \ Category $ category ) { $ filterParam = $ category -> getId ( ) ; if ( $ category -> getVirtualRule ( ) ) { $ category -> setIsActive ( true ) ; $ filterParam = $ category -> getVirtualRule ( ) -> getCategorySearchQuery ( $ category ) ; } return $ ... | Return category filter param |
43,656 | 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 ) ; $ t... | Append ES specifics fields into the attribute edit store front tab . |
43,657 | private function moveOrginalFields ( Form $ form ) { $ originalFieldset = $ form -> getElement ( 'front_fieldset' ) ; $ targetFieldset = $ form -> getElement ( 'elasticsuite_catalog_attribute_fieldset' ) ; foreach ( $ this -> movedFields as $ elementId ) { $ element = $ form -> getElement ( $ elementId ) ; if ( $ eleme... | Move original fields to the new fieldset . |
43,658 | private function addAutocompleteFields ( Fieldset $ fieldset ) { $ fieldset -> addField ( 'is_displayed_in_autocomplete' , 'select' , [ 'name' => 'is_displayed_in_autocomplete' , 'label' => __ ( 'Display in autocomplete' ) , 'values' => $ this -> booleanSource -> toOptionArray ( ) , ] , 'is_used_in_spellcheck' ) ; retu... | Append autocomplete related fields . |
43,659 | private function addFacetFields ( Fieldset $ fieldset ) { $ fieldset -> addField ( 'facet_min_coverage_rate' , 'text' , [ 'name' => 'facet_min_coverage_rate' , 'label' => __ ( 'Facet coverage rate' ) , 'class' => 'validate-digits validate-digits-range digits-range-0-100' , 'value' => '90' , 'note' => __ ( 'Ex: Brand fa... | Append faceting related fields . |
43,660 | private function addSearchFields ( Fieldset $ fieldset ) { $ fieldset -> addField ( 'search_weight' , 'select' , [ 'name' => 'search_weight' , 'label' => __ ( 'Search Weight' ) , 'values' => $ this -> weightSource -> getOptions ( ) , ] , 'is_searchable' ) ; $ fieldset -> addField ( 'is_used_in_spellcheck' , 'select' , ... | Append spellchecking related fields . |
43,661 | private function addSortFields ( Fieldset $ fieldset ) { $ sortFieldsOptions = [ [ 'value' => '_first' , 'label' => __ ( "First" ) ] , [ 'value' => '_last' , 'label' => __ ( "Last" ) ] , ] ; $ fieldset -> addField ( 'sort_order_asc_missing' , 'select' , [ 'name' => 'sort_order_asc_missing' , 'label' => __ ( 'Sort produ... | Append sorting related fields . |
43,662 | private function createDisplayFieldset ( Form $ form , Front $ subject ) { $ fieldset = $ form -> addFieldset ( 'elasticsuite_catalog_attribute_display_fieldset' , [ 'legend' => __ ( 'Slider Display Configuration' ) , 'collapsable' => $ subject -> getRequest ( ) -> has ( 'popup' ) , ] , 'elasticsuite_catalog_attribute_... | Append the Slider Display Configuration fieldset to the tab . |
43,663 | private function appendSliderDisplayRelatedFields ( $ form , $ subject ) { $ attribute = $ this -> getAttribute ( ) ; $ isAttributeDecimal = $ attribute -> getBackendType ( ) == 'decimal' || $ attribute -> getFrontendClass ( ) == 'validate-number' ; if ( $ isAttributeDecimal && ( $ attribute -> getFrontendInput ( ) !==... | Append slider display related fields |
43,664 | private function appendFieldsDependency ( $ subject ) { $ dependencyBlock = $ subject -> getChildBlock ( 'form_after' ) ; if ( $ dependencyBlock ) { $ dependencyBlock -> addFieldMap ( 'is_displayed_in_autocomplete' , 'is_displayed_in_autocomplete' ) -> addFieldMap ( 'is_filterable_in_search' , 'is_filterable_in_search'... | Manage dependency between fields . |
43,665 | private function getAttributesList ( ) { if ( null === $ this -> attributesList ) { $ this -> attributesList = [ ] ; $ collection = $ this -> attributesCollectionFactory -> create ( ) ; foreach ( $ collection as $ attribute ) { $ this -> attributesList [ $ attribute -> getId ( ) ] = [ 'value' => $ attribute -> getAttri... | Retrieve list of attributes that can be used to define virtual attributes rules . |
43,666 | public function aroundGetMeta ( CategoryDataProvider $ dataProvider , \ Closure $ proceed ) { $ meta = $ proceed ( ) ; $ currentCategory = $ dataProvider -> getCurrentCategory ( ) ; if ( $ currentCategory -> getId ( ) === null || $ currentCategory -> getLevel ( ) < 2 ) { $ meta [ 'display_settings' ] [ 'children' ] [ '... | Remove filter configuration from meta in case of a new category or a root one . Meta is added in the ui_component via XML . |
43,667 | private function getFilterableAttributeList ( $ currentCategory ) { $ attributesList = [ ] ; foreach ( $ this -> getAttributes ( $ currentCategory ) as $ attribute ) { $ attributesList [ ] = [ 'attribute_id' => ( int ) $ attribute -> getAttributeId ( ) , 'attribute_label' => $ attribute -> getFrontendLabel ( ) , 'facet... | Retrieve facet configuration for current category . Compute the intersection between existing data for the category and all attributes set as filterable . |
43,668 | private function getDefaultStoreId ( ) { $ store = $ this -> storeManager -> getDefaultStoreView ( ) ; if ( null === $ store ) { $ store = ! empty ( $ this -> storeManager -> getWebsites ( ) ) ? current ( $ this -> storeManager -> getWebsites ( ) ) -> getDefaultStore ( ) : null ; } return $ store ? $ store -> getId ( )... | Retrieve default store view id . |
43,669 | private function getAttributes ( $ category ) { $ collection = $ this -> attributeCollectionFactory -> create ( [ 'category' => $ category ] ) ; $ collection -> setCategory ( $ category ) -> addIsFilterableFilter ( ) -> addStoreLabel ( $ category -> getStoreId ( ) ) -> setOrder ( 'position' , 'ASC' ) -> setOrder ( 'att... | Retrieve attribute collection pre - filtered with only filterable attributes . |
43,670 | private function readConfiguration ( array $ options , DeploymentConfig $ deploymentConfig , $ inputKey ) { $ config = null ; $ option = $ this -> getOption ( $ inputKey ) ; if ( $ option ) { $ configPath = $ option -> getConfigPath ( $ inputKey ) ; $ config = $ options [ $ inputKey ] ?? ( $ configPath != null ? $ depl... | Read a value from the input with fallback to the current deployment config . |
43,671 | private function getOption ( $ inputKey ) { $ option = null ; foreach ( $ this -> getOptions ( ) as $ currentOption ) { $ option = $ currentOption -> getName ( ) == $ inputKey ? $ currentOption : $ option ; } return $ option ; } | Retrieve option by input key . |
43,672 | public function buildQuery ( QueryInterface $ query ) { $ searchQuery = false ; $ builder = $ this -> getBuilder ( $ query ) ; if ( $ builder !== null ) { $ searchQuery = $ builder -> buildQuery ( $ query ) ; } return $ searchQuery ; } | Build the ES query from a Query |
43,673 | private function getBuilder ( $ query ) { $ queryType = $ query -> getType ( ) ; if ( ! isset ( $ this -> builders [ $ queryType ] ) ) { throw new \ InvalidArgumentException ( "Unknow query builder for {$queryType}." ) ; } return $ this -> builders [ $ queryType ] ; } | Retrieve the builder used to build a query . |
43,674 | public function afterSetForm ( \ Magento \ Catalog \ Block \ Adminhtml \ Product \ Attribute \ Edit \ Tab \ Front $ subject ) { if ( $ this -> getAttribute ( ) && $ this -> swatchHelper -> isSwatchAttribute ( $ this -> getAttribute ( ) ) ) { if ( $ subject -> getForm ( ) && $ subject -> getForm ( ) -> getElement ( 'fac... | Disable facet_max_size field for swatches attributes . |
43,675 | private function initLayer ( ) { $ this -> layerResolver -> create ( $ this -> getLayerType ( ) ) ; if ( $ this -> getRequest ( ) -> getParam ( 'cat' ) ) { $ category = $ this -> categoryFactory -> create ( ) -> setId ( $ this -> getRequest ( ) -> getParam ( 'cat' ) ) ; $ this -> layerResolver -> get ( ) -> setCurrentC... | Init the current navigation layer . |
43,676 | private function applyFilters ( ) { $ layer = $ this -> layerResolver -> get ( ) ; $ filterList = $ this -> getFilterList ( ) ; foreach ( $ filterList -> getFilters ( $ layer ) as $ filter ) { $ filter -> apply ( $ this -> getRequest ( ) ) ; } $ layer -> apply ( ) ; return $ this ; } | Apply current filters to the layer product collection . |
43,677 | private function getItems ( ) { $ items = [ ] ; $ layer = $ this -> layerResolver -> get ( ) ; $ filterList = $ this -> getFilterList ( ) ; foreach ( $ filterList -> getFilters ( $ layer ) as $ filter ) { if ( $ filter -> getRequestVar ( ) == $ this -> getFilterName ( ) ) { foreach ( $ filter -> getItems ( ) as $ item ... | Returns array of items loaded through ajax . |
43,678 | public function getDisplayedFilters ( ) { $ displayedFilters = array_filter ( $ this -> getFilters ( ) , function ( $ filter ) { return $ filter -> getItemsCount ( ) > 0 ; } ) ; return array_values ( $ displayedFilters ) ; } | Returns facet that are displayed . |
43,679 | public function getVariables ( ) { $ variables = [ 'search.query' => $ this -> catalogSearchData -> getEscapedQueryText ( ) ] ; if ( $ layer = $ this -> catalogLayer ) { $ productCollection = $ layer -> getProductCollection ( ) ; $ variables [ 'search.is_spellchecked' ] = ( int ) $ productCollection -> isSpellchecked (... | Append the user fulltext query to the tracked variables list |
43,680 | public function afterGet ( \ Magento \ Search \ Model \ QueryFactory $ queryFactory , \ Magento \ Search \ Model \ Query $ query ) { if ( $ query && $ query -> getQueryText ( ) !== '' ) { $ this -> searchContext -> setCurrentSearchQuery ( $ query ) ; } return $ query ; } | Set the current search query into the Search context after being retrieved . |
43,681 | public function create ( $ storeId , $ containerName , $ from , $ size , $ query = null , $ sortOrders = [ ] , $ filters = [ ] , $ queryFilters = [ ] , $ facets = [ ] ) { $ containerConfig = $ this -> getRequestContainerConfiguration ( $ storeId , $ containerName ) ; $ containerFilters = $ this -> getContainerFilters (... | Create a new search request . |
43,682 | private function getContainerAggregations ( ContainerConfigurationInterface $ containerConfig , $ query , $ filters , $ queryFilters ) { return $ this -> aggregationResolver -> getContainerAggregations ( $ containerConfig , $ query , $ filters , $ queryFilters ) ; } | Returns aggregations configured in the search container . |
43,683 | private function getSpellingType ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { if ( is_array ( $ queryText ) ) { $ queryText = implode ( " " , $ queryText ) ; } $ spellcheckRequestParams = [ 'index' => $ containerConfig -> getIndexName ( ) , 'type' => $ containerConfig -> getTypeName ( ) , 'quer... | Retireve the spelling type for a fulltext query . |
43,684 | private function buildSortOrder ( SortOrderInterface $ sortOrder ) { $ sortField = $ sortOrder -> getField ( ) ; $ sortOrderConfig = [ 'order' => $ sortOrder -> getDirection ( ) ] ; if ( $ sortField !== SortOrderInterface :: DEFAULT_SORT_FIELD ) { $ sortOrderConfig [ 'missing' ] = $ sortOrder -> getMissing ( ) ; $ sort... | Build a sort order ES condition from a SortOrderInterface specification . |
43,685 | public function getCookieConfig ( ) { $ config = $ this -> scopeConfig -> getValue ( self :: CONFIG_COOKIE ) ; $ config [ 'domain' ] = $ this -> sessionManager -> getCookieDomain ( ) ; $ config [ 'path' ] = $ this -> sessionManager -> getCookiePath ( ) ; return $ config ; } | Return an array containing the cookie configuration |
43,686 | private function getCategoryCollection ( ) { $ categoryCollection = null ; $ suggestedTerms = $ this -> getSuggestedTerms ( ) ; $ terms = [ $ this -> queryFactory -> get ( ) -> getQueryText ( ) ] ; if ( ! empty ( $ suggestedTerms ) ) { $ terms = array_merge ( $ terms , $ suggestedTerms ) ; } $ categoryCollection = $ th... | Suggested categories collection . Returns null if no suggested search terms . |
43,687 | public function saveLink ( $ linkData ) { $ connection = $ this -> getConnection ( ) ; if ( isset ( $ linkData [ 'delete_after' ] ) && ( $ linkData [ 'delete_after' ] instanceof \ DateTime ) ) { $ linkData [ 'delete_after' ] = $ this -> formatDate ( $ linkData [ 'delete_after' ] ) ; } $ connection -> insertOnDuplicate ... | Save customer link . |
43,688 | public function deleteByCustomerId ( $ customerId ) { $ connection = $ this -> getConnection ( ) ; $ connection -> delete ( $ this -> getMainTable ( ) , $ connection -> quoteInto ( 'customer_id = ?' , $ customerId ) ) ; } | Delete all link data for a given customer id . |
43,689 | public function deleteByDeleteAfter ( \ DateTime $ dateTime ) { $ connection = $ this -> getConnection ( ) ; $ deleteAfter = $ this -> formatDate ( $ dateTime ) ; $ connection -> delete ( $ this -> getMainTable ( ) , $ connection -> quoteInto ( 'delete_after <= ?' , $ deleteAfter ) ) ; } | Delete all link data that are having a delete_after column which is lteq than the one passed in parameter . |
43,690 | public function setDeleteAfter ( int $ customerId , \ DateTime $ dateTime ) { $ connection = $ this -> getConnection ( ) ; $ deleteAfter = $ this -> formatDate ( $ dateTime ) ; $ connection -> update ( $ this -> getMainTable ( ) , [ 'delete_after' => $ deleteAfter ] , $ connection -> quoteInto ( 'customer_id = ?' , $ c... | Set the delete after field for a given customer Id . |
43,691 | public function getVisitorIds ( $ customerId ) { $ connection = $ this -> getConnection ( ) ; $ select = $ connection -> select ( ) -> from ( $ this -> getMainTable ( ) , [ 'visitor_id' ] ) -> where ( $ connection -> quoteInto ( 'customer_id = ?' , $ customerId ) ) ; return array_unique ( $ connection -> fetchCol ( $ s... | Retrieve all visitor ids used by a given customer Id . |
43,692 | private function formatDate ( \ DateTime $ dateTime ) { return $ dateTime -> format ( \ Magento \ Framework \ DB \ Adapter \ Pdo \ Mysql :: DATE_FORMAT ) ; } | Format a DateTime object to proper format for DB saving . |
43,693 | public function build ( $ options = [ ] ) { $ options = array_merge ( $ this -> defaultOptions , $ options ) ; $ clientBuilder = $ this -> clientBuilder -> create ( ) ; $ hosts = $ this -> getHosts ( $ options ) ; if ( ! empty ( $ hosts ) ) { $ clientBuilder -> setHosts ( $ hosts ) ; } if ( $ options [ 'is_debug_mode_e... | Build an ES client from options . |
43,694 | private function getHosts ( $ options ) { $ hosts = [ ] ; if ( is_string ( $ options [ 'servers' ] ) ) { $ options [ 'servers' ] = explode ( ',' , $ options [ 'servers' ] ) ; } foreach ( $ options [ 'servers' ] as $ host ) { if ( ! empty ( $ host ) ) { list ( $ hostname , $ port ) = array_pad ( explode ( ':' , trim ( $... | Return hosts config used to connect to the cluster . |
43,695 | public function load ( ) { if ( $ this -> _configData === null ) { $ this -> initScope ( ) ; $ this -> _configData = $ this -> _getConfig ( false ) ; } return $ this -> _configData ; } | Load config data for section |
43,696 | private function initScope ( ) { if ( $ this -> getSection ( ) === null ) { $ this -> setSection ( '' ) ; } if ( $ this -> getContainer ( ) === null ) { $ this -> setContainer ( '' ) ; } if ( $ this -> getStore ( ) === null ) { $ this -> setStore ( '' ) ; } $ scope = 'default' ; $ scopeCode = 'default' ; if ( $ this ->... | Get scope name and scopeId |
43,697 | public function getAggregationData ( \ Magento \ Catalog \ Model \ ResourceModel \ Eav \ Attribute $ attribute ) { $ type = $ attribute -> getBackendType ( ) ; $ aggregation = isset ( $ this -> aggregations [ $ type ] ) ? $ this -> aggregations [ $ type ] : $ this -> defaultAggregation ; if ( $ attribute -> getBackendT... | Get Aggregation Data for a given product attribute . |
43,698 | private function getIndex ( ) { $ indexName = $ this -> readBaseConfigParam ( 'index' ) ; return $ this -> indexManager -> getIndexByName ( $ indexName , $ this -> storeId ) ; } | Retrieve the index associated with the currrent search request container . |
43,699 | public function canUseDefaultValue ( $ fieldValue ) { if ( $ this -> getScope ( ) == ContainerScopeInterface :: SCOPE_STORE_CONTAINERS && $ fieldValue ) { return true ; } if ( $ this -> getScope ( ) == ContainerScopeInterface :: SCOPE_CONTAINERS && $ fieldValue ) { return true ; } return false ; } | Check if can use default value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.