idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
44,600 | public static function buildBlockTypeGroup ( string $ identifier , array $ config , array $ blockTypes ) : BlockTypeGroup { return BlockTypeGroup :: fromArray ( [ 'identifier' => $ identifier , 'isEnabled' => $ config [ 'enabled' ] , 'name' => $ config [ 'name' ] , 'blockTypes' => $ blockTypes , ] ) ; } | Builds the block type group . |
44,601 | public function mapRule ( PersistenceRule $ rule ) : Rule { $ ruleData = [ 'id' => $ rule -> id , 'status' => $ rule -> status , 'layout' => function ( ) use ( $ rule ) : ? Layout { try { return $ rule -> layoutId !== null ? $ this -> layoutService -> loadLayout ( $ rule -> layoutId ) : null ; } catch ( NotFoundExcepti... | Builds the API rule value from persistence one . |
44,602 | public function mapTarget ( PersistenceTarget $ target ) : Target { try { $ targetType = $ this -> targetTypeRegistry -> getTargetType ( $ target -> type ) ; } catch ( TargetTypeException $ e ) { $ targetType = new NullTargetType ( ) ; } $ targetData = [ 'id' => $ target -> id , 'status' => $ target -> status , 'ruleId... | Builds the API target value from persistence one . |
44,603 | public function mapCondition ( PersistenceCondition $ condition ) : Condition { try { $ conditionType = $ this -> conditionTypeRegistry -> getConditionType ( $ condition -> type ) ; } catch ( ConditionTypeException $ e ) { $ conditionType = new NullConditionType ( ) ; } $ conditionData = [ 'id' => $ condition -> id , '... | Builds the API condition value from persistence one . |
44,604 | protected function updateRules ( ContainerBuilder $ container , ? array $ allRules ) : array { $ allRules = is_array ( $ allRules ) ? $ allRules : [ ] ; $ defaultTemplates = $ container -> getParameter ( 'netgen_block_manager.default_view_templates' ) ; foreach ( $ defaultTemplates as $ viewName => $ viewTemplates ) { ... | Updates all view rules to add the default template match . |
44,605 | protected function addDefaultRule ( string $ viewName , string $ context , array $ rules , string $ defaultTemplate ) : array { $ rules += [ " {$viewName}_{$context}_default " => [ 'template' => $ defaultTemplate , 'match' => [ ] , 'parameters' => [ ] , ] , ] ; return $ rules ; } | Adds the default view template as a fallback to specified view rules . |
44,606 | public function onException ( GetResponseForExceptionEvent $ event ) : void { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ attributes = $ event -> getRequest ( ) -> attributes ; if ( $ attributes -> get ( SetIsApiRequestListener :: API_FLAG_NAME ) !== true ) { return ; } $ exception = $ event -> getException ... | Converts exceptions to Symfony HTTP exceptions . |
44,607 | public function getPlaceholder ( string $ identifier ) : APIPlaceholder { if ( $ this -> hasPlaceholder ( $ identifier ) ) { return $ this -> placeholders [ $ identifier ] ; } throw BlockException :: noPlaceholder ( $ identifier ) ; } | Returns the specified placeholder . |
44,608 | public function getCollection ( string $ identifier ) : Collection { if ( ! $ this -> hasCollection ( $ identifier ) ) { throw BlockException :: noCollection ( $ identifier ) ; } return $ this -> collections -> get ( $ identifier ) ; } | Returns the specified block collection . |
44,609 | public function hasDynamicParameter ( string $ parameter ) : bool { $ this -> buildDynamicParameters ( ) ; return $ this -> dynamicParameters -> offsetExists ( $ parameter ) ; } | Returns if the object has a specified dynamic parameter . |
44,610 | private function buildDynamicParameters ( ) : void { $ this -> dynamicParameters = $ this -> dynamicParameters ?? $ this -> definition -> getDynamicParameters ( $ this ) ; } | Builds the dynamic parameters of the block from the block definition . |
44,611 | public function mapBlock ( PersistenceBlock $ block , ? array $ locales = null , bool $ useMainLocale = true ) : Block { try { $ blockDefinition = $ this -> blockDefinitionRegistry -> getBlockDefinition ( $ block -> definitionIdentifier ) ; } catch ( BlockDefinitionException $ e ) { $ blockDefinition = new NullBlockDef... | Builds the API block value from persistence one . |
44,612 | private function loadCollections ( PersistenceBlock $ block ) : Generator { $ collectionReferences = $ this -> blockHandler -> loadCollectionReferences ( $ block ) ; foreach ( $ collectionReferences as $ collectionReference ) { yield $ collectionReference -> identifier => $ this -> collectionHandler -> loadCollection (... | Loads all persistence collections belonging to the provided block . |
44,613 | private function mapPlaceholders ( PersistenceBlock $ block , BlockDefinitionInterface $ blockDefinition , ? array $ locales = null ) : Generator { if ( ! $ blockDefinition instanceof ContainerDefinitionInterface ) { return ; } foreach ( $ blockDefinition -> getPlaceholders ( ) as $ placeholderIdentifier ) { yield $ pl... | Maps the placeholder from persistence parameters . |
44,614 | public function getParameterValue ( string $ parameterName ) { if ( ! $ this -> hasParameterValue ( $ parameterName ) ) { return null ; } return $ this -> parameterValues [ $ parameterName ] ; } | Returns the parameter value with provided name or null if parameter does not exist . |
44,615 | private function fillDefault ( ParameterDefinitionCollectionInterface $ definitionCollection ) : void { foreach ( $ definitionCollection -> getParameterDefinitions ( ) as $ name => $ definition ) { $ this -> setParameterValue ( $ name , $ definition -> getDefaultValue ( ) ) ; if ( $ definition instanceof CompoundParame... | Fills the struct with the default parameter values as defined in provided parameter definition collection . |
44,616 | private function fillFromCollection ( ParameterDefinitionCollectionInterface $ definitionCollection , ParameterCollectionInterface $ parameters ) : void { foreach ( $ definitionCollection -> getParameterDefinitions ( ) as $ name => $ definition ) { $ value = null ; if ( $ parameters -> hasParameter ( $ name ) ) { $ par... | Fills the struct values based on provided parameter collection . |
44,617 | private function fillFromHash ( ParameterDefinitionCollectionInterface $ definitionCollection , array $ values , bool $ doImport = false ) : void { foreach ( $ definitionCollection -> getParameterDefinitions ( ) as $ name => $ definition ) { $ value = $ definition -> getDefaultValue ( ) ; $ parameterType = $ definition... | Fills the struct values based on provided array of values . |
44,618 | public function getItemViewType ( string $ itemViewType ) : ItemViewType { if ( ! $ this -> hasItemViewType ( $ itemViewType ) ) { throw BlockDefinitionException :: noItemViewType ( $ this -> identifier , $ itemViewType ) ; } return $ this -> itemViewTypes [ $ itemViewType ] ; } | Returns the item view type with provided identifier . |
44,619 | public function renderPlugins ( array $ context , string $ pluginName ) : string { try { return $ this -> pluginRenderer -> renderPlugins ( $ pluginName , $ context ) ; } catch ( Throwable $ t ) { $ this -> errorHandler -> handleError ( $ t ) ; } return '' ; } | Renders all the template plugins with provided name . |
44,620 | public function buildConfigDefinition ( string $ configKey , ConfigDefinitionHandlerInterface $ handler ) : ConfigDefinitionInterface { $ parameterBuilder = $ this -> parameterBuilderFactory -> createParameterBuilder ( ) ; $ handler -> buildParameters ( $ parameterBuilder ) ; $ parameterDefinitions = $ parameterBuilder... | Builds the config definition . |
44,621 | public function getParameter ( string $ parameterName ) : Parameter { if ( ! $ this -> hasParameter ( $ parameterName ) ) { throw ParameterException :: noParameter ( $ parameterName ) ; } return $ this -> parameters [ $ parameterName ] ; } | Returns the parameter with provided name . |
44,622 | private function logError ( Throwable $ throwable , ? string $ message = null , array $ context = [ ] ) : void { $ context [ 'error' ] = $ throwable ; $ this -> logger -> critical ( $ message ?? $ throwable -> getMessage ( ) , $ context ) ; } | Logs the error . |
44,623 | public function getConfig ( string $ configKey ) : APIConfig { if ( $ this -> hasConfig ( $ configKey ) ) { return $ this -> configs [ $ configKey ] ; } throw ConfigException :: noConfig ( $ configKey ) ; } | Returns the config with specified config key . |
44,624 | private function loadLayouts ( array $ layoutIds ) : Generator { foreach ( $ layoutIds as $ layoutId ) { try { yield $ this -> layoutService -> loadLayout ( $ layoutId ) ; } catch ( NotFoundException $ e ) { continue ; } } } | Loads the layouts for provided IDs . |
44,625 | private function loadRules ( array $ ruleIds ) : Generator { foreach ( $ ruleIds as $ ruleId ) { try { yield $ this -> layoutResolverService -> loadRule ( $ ruleId ) ; } catch ( NotFoundException $ e ) { continue ; } } } | Loads the rules for provided IDs . |
44,626 | public function onKernelRequest ( GetResponseEvent $ event ) : void { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ request = $ event -> getRequest ( ) ; if ( $ request -> attributes -> has ( 'ngbmContext' ) ) { $ context = $ request -> attributes -> get ( 'ngbmContext' ) ; $ context = is_array ( $ context ) ?... | Builds the context object . |
44,627 | private function getUriContext ( Request $ request ) : array { $ context = $ request -> query -> get ( 'ngbmContext' ) ; $ context = is_array ( $ context ) ? $ context : [ ] ; if ( ! $ this -> uriSigner -> check ( $ this -> getUri ( $ request ) ) ) { return [ ] ; } return $ context ; } | Validates and returns the array with context information filled from the URI . |
44,628 | private function getUri ( Request $ request ) : string { if ( $ request -> attributes -> has ( 'ngbmContextUri' ) ) { return $ request -> attributes -> get ( 'ngbmContextUri' ) ; } return $ request -> getRequestUri ( ) ; } | Returns the URI with the context from the request . This allows overriding the URI with a value stored in request attributes if for example there s need to pre - process the URI before checking the signature . |
44,629 | protected function validate ( $ value , $ constraints , ? string $ propertyPath = null ) : void { try { $ violations = $ this -> validator -> validate ( $ value , $ constraints ) ; } catch ( Throwable $ t ) { throw ValidationException :: validationFailed ( $ propertyPath ?? '' , $ t -> getMessage ( ) , $ t ) ; } if ( c... | Validates the value against a set of provided constraints . |
44,630 | public function getConfigDefinition ( string $ configKey ) : ConfigDefinitionInterface { if ( ! $ this -> hasConfigDefinition ( $ configKey ) ) { throw ConfigDefinitionException :: noConfigDefinition ( $ configKey ) ; } return $ this -> configDefinitions [ $ configKey ] ; } | Returns the config definition with provided config key . |
44,631 | public function onKernelResponse ( FilterResponseEvent $ event ) : void { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ layoutView = $ event -> getRequest ( ) -> attributes -> get ( $ this -> isExceptionResponse ? 'ngbmExceptionLayoutView' : 'ngbmLayoutView' ) ; if ( ! $ layoutView instanceof LayoutViewInterfa... | Tags the response with the data for layout provided by the event . |
44,632 | private function normalizeResultItem ( CmsItemInterface $ resultItem , int $ version , ? string $ format = null , array $ context = [ ] ) : array { $ collectionItem = null ; $ cmsItem = $ resultItem ; $ isDynamic = true ; if ( $ resultItem instanceof ManualItem ) { $ collectionItem = $ resultItem -> getCollectionItem (... | Normalizes the provided result item into an array . |
44,633 | private function buildConstraintFields ( ParameterStruct $ parameterStruct , ParameterStructConstraint $ constraint ) : Generator { foreach ( $ constraint -> parameterDefinitions -> getParameterDefinitions ( ) as $ parameterDefinition ) { $ constraints = $ this -> getParameterConstraints ( $ parameterDefinition , $ par... | Builds the fields array of the Collection constraint from provided parameters and parameter values . |
44,634 | private function getParameterConstraints ( ParameterDefinition $ parameterDefinition , ParameterStruct $ parameterStruct , bool $ validateEmptyValue = true ) : array { $ parameterValue = $ parameterStruct -> getParameterValue ( $ parameterDefinition -> getName ( ) ) ; if ( ! $ validateEmptyValue && $ parameterValue ===... | Returns all constraints applied on a parameter coming directly from parameter type . |
44,635 | private function getRuntimeParameterConstraints ( ParameterDefinition $ parameterDefinition , $ parameterValue , array $ allParameterValues ) : Generator { foreach ( $ parameterDefinition -> getConstraints ( ) as $ constraint ) { if ( $ constraint instanceof Closure ) { $ constraint = $ constraint ( $ parameterValue , ... | Returns all constraints applied on a parameter coming from the parameter definition . |
44,636 | public function onRenderView ( CollectViewParametersEvent $ event ) : void { $ view = $ event -> getView ( ) ; if ( ! $ view instanceof BlockViewInterface ) { return ; } $ block = $ view -> getBlock ( ) ; $ blockDefinition = $ block -> getDefinition ( ) ; if ( ! $ blockDefinition instanceof TwigBlockDefinitionInterface... | Adds a parameter to the view with the Twig block content . |
44,637 | private function getTwigBlockContent ( TwigBlockDefinitionInterface $ blockDefinition , Block $ block , array $ parameters ) : string { if ( ! isset ( $ parameters [ 'twig_template' ] ) ) { return '' ; } if ( ! $ parameters [ 'twig_template' ] instanceof ContextualizedTwigTemplate ) { return '' ; } return $ parameters ... | Returns the Twig block content from the provided block . |
44,638 | public function validateRuleCreateStruct ( RuleCreateStruct $ ruleCreateStruct ) : void { if ( $ ruleCreateStruct -> layoutId !== null ) { $ this -> validate ( $ ruleCreateStruct -> layoutId , [ new Constraints \ NotBlank ( ) , new Constraints \ Type ( [ 'type' => 'scalar' ] ) , ] , 'layoutId' ) ; } if ( $ ruleCreateSt... | Validates the provided rule create struct . |
44,639 | public function validateRuleUpdateStruct ( RuleUpdateStruct $ ruleUpdateStruct ) : void { if ( $ ruleUpdateStruct -> layoutId !== null ) { $ this -> validate ( $ ruleUpdateStruct -> layoutId , [ new Constraints \ NotBlank ( ) , new Constraints \ Type ( [ 'type' => 'scalar' ] ) , ] , 'layoutId' ) ; } if ( $ ruleUpdateSt... | Validates the provided rule update struct . |
44,640 | public function validateRuleMetadataUpdateStruct ( RuleMetadataUpdateStruct $ ruleUpdateStruct ) : void { if ( $ ruleUpdateStruct -> priority !== null ) { $ this -> validate ( $ ruleUpdateStruct -> priority , [ new Constraints \ NotBlank ( ) , new Constraints \ Type ( [ 'type' => 'int' ] ) , ] , 'priority' ) ; } } | Validates the provided rule metadata update struct . |
44,641 | public function validateTargetCreateStruct ( TargetCreateStruct $ targetCreateStruct ) : void { $ this -> validate ( $ targetCreateStruct -> type , [ new Constraints \ NotBlank ( ) , new Constraints \ Type ( [ 'type' => 'string' ] ) , ] , 'type' ) ; $ targetType = $ this -> targetTypeRegistry -> getTargetType ( $ targe... | Validates the provided target create struct . |
44,642 | public function validateTargetUpdateStruct ( Target $ target , TargetUpdateStruct $ targetUpdateStruct ) : void { $ targetType = $ target -> getTargetType ( ) ; $ this -> validate ( $ targetUpdateStruct -> value , $ targetType -> getConstraints ( ) , 'value' ) ; } | Validates the provided target update struct . |
44,643 | public function validateConditionCreateStruct ( ConditionCreateStruct $ conditionCreateStruct ) : void { $ this -> validate ( $ conditionCreateStruct -> type , [ new Constraints \ NotBlank ( ) , new Constraints \ Type ( [ 'type' => 'string' ] ) , ] , 'type' ) ; $ conditionType = $ this -> conditionTypeRegistry -> getCo... | Validates the provided condition create struct . |
44,644 | public function validateConditionUpdateStruct ( Condition $ condition , ConditionUpdateStruct $ conditionUpdateStruct ) : void { $ conditionType = $ condition -> getConditionType ( ) ; $ this -> validate ( $ conditionUpdateStruct -> value , $ conditionType -> getConstraints ( ) , 'value' ) ; } | Validates the provided condition update struct . |
44,645 | public function mapZone ( PersistenceZone $ zone ) : Zone { $ zoneData = [ 'identifier' => $ zone -> identifier , 'layoutId' => $ zone -> layoutId , 'status' => $ zone -> status , 'linkedZone' => function ( ) use ( $ zone ) : ? Zone { if ( $ zone -> linkedLayoutId === null || $ zone -> linkedZoneIdentifier === null ) {... | Builds the API zone value from persistence one . |
44,646 | public function mapLayout ( PersistenceLayout $ layout ) : Layout { try { $ layoutType = $ this -> layoutTypeRegistry -> getLayoutType ( $ layout -> type ) ; } catch ( LayoutTypeException $ e ) { $ layoutType = new NullLayoutType ( $ layout -> type ) ; } $ layoutData = [ 'id' => $ layout -> id , 'layoutType' => $ layou... | Builds the API layout value from persistence one . |
44,647 | public function loadRuleData ( $ ruleId , int $ status ) : array { $ query = $ this -> getRuleSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'r.id' , ':id' ) ) -> setParameter ( 'id' , $ ruleId , Type :: INTEGER ) ; $ this -> applyStatusCondition ( $ query , $ status , 'r.status' ) ; return $ query ->... | Returns all data for specified rule . |
44,648 | public function loadRulesData ( int $ status , ? Layout $ layout = null , int $ offset = 0 , ? int $ limit = null ) : array { $ query = $ this -> getRuleSelectQuery ( ) ; if ( $ layout instanceof Layout ) { $ query -> andWhere ( $ query -> expr ( ) -> eq ( 'layout_id' , ':layout_id' ) ) -> setParameter ( 'layout_id' , ... | Returns all data for all rules . |
44,649 | public function getRuleCount ( int $ ruleStatus , ? Layout $ layout = null ) : int { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'count(*) AS count' ) -> from ( 'ngbm_rule' ) ; if ( $ layout instanceof Layout ) { $ query -> andWhere ( $ query -> expr ( ) -> eq ( 'layout_id' , ':layout... | Returns the number of rules . |
44,650 | public function matchRules ( string $ targetType , $ targetValue ) : array { $ query = $ this -> getRuleSelectQuery ( ) ; $ query -> innerJoin ( 'r' , 'ngbm_rule_target' , 'rt' , $ query -> expr ( ) -> eq ( 'r.id' , 'rt.rule_id' ) ) -> where ( $ query -> expr ( ) -> eq ( 'rd.enabled' , ':enabled' ) , $ query -> expr ( ... | Returns all rule data for rules that match specified target type and value . |
44,651 | public function loadTargetData ( $ targetId , int $ status ) : array { $ query = $ this -> getTargetSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'id' , ':id' ) ) -> setParameter ( 'id' , $ targetId , Type :: INTEGER ) ; $ this -> applyStatusCondition ( $ query , $ status ) ; return $ query -> execut... | Returns all data for specified target . |
44,652 | public function loadRuleTargetsData ( Rule $ rule ) : array { $ query = $ this -> getTargetSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'rule_id' , ':rule_id' ) ) -> setParameter ( 'rule_id' , $ rule -> id , Type :: INTEGER ) -> orderBy ( 'id' , 'ASC' ) ; $ this -> applyStatusCondition ( $ query , $... | Returns all data for all rule targets . |
44,653 | public function getTargetCount ( Rule $ rule ) : int { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'count(*) AS count' ) -> from ( 'ngbm_rule_target' ) -> where ( $ query -> expr ( ) -> eq ( 'rule_id' , ':rule_id' ) ) -> setParameter ( 'rule_id' , $ rule -> id , Type :: INTEGER ) ; $ ... | Returns the number of targets within the rule . |
44,654 | public function loadConditionData ( $ conditionId , int $ status ) : array { $ query = $ this -> getConditionSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'id' , ':id' ) ) -> setParameter ( 'id' , $ conditionId , Type :: INTEGER ) ; $ this -> applyStatusCondition ( $ query , $ status ) ; return $ que... | Returns all data for specified condition . |
44,655 | public function getLowestRulePriority ( ) : ? int { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'priority' ) -> from ( 'ngbm_rule_data' ) ; $ query -> addOrderBy ( 'priority' , 'ASC' ) ; $ this -> applyOffsetAndLimit ( $ query , 0 , 1 ) ; $ data = $ query -> execute ( ) -> fetchAll ( ... | Returns the lowest priority from the list of all the rules . |
44,656 | public function updateRule ( Rule $ rule ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ngbm_rule' ) -> set ( 'layout_id' , ':layout_id' ) -> set ( 'comment' , ':comment' ) -> where ( $ query -> expr ( ) -> eq ( 'id' , ':id' ) ) -> setParameter ( 'id' , $ rule -> id , Type ::... | Updates a rule . |
44,657 | public function updateRuleData ( Rule $ rule ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ngbm_rule_data' ) -> set ( 'enabled' , ':enabled' ) -> set ( 'priority' , ':priority' ) -> where ( $ query -> expr ( ) -> eq ( 'rule_id' , ':rule_id' ) ) -> setParameter ( 'rule_id' , ... | Updates rule data which is independent of statuses . |
44,658 | public function addTarget ( Target $ target ) : Target { $ query = $ this -> connection -> createQueryBuilder ( ) -> insert ( 'ngbm_rule_target' ) -> values ( [ 'id' => ':id' , 'status' => ':status' , 'rule_id' => ':rule_id' , 'type' => ':type' , 'value' => ':value' , ] ) -> setValue ( 'id' , $ target -> id !== null ? ... | Adds a target . |
44,659 | public function updateTarget ( Target $ target ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ngbm_rule_target' ) -> set ( 'rule_id' , ':rule_id' ) -> set ( 'type' , ':type' ) -> set ( 'value' , ':value' ) -> where ( $ query -> expr ( ) -> eq ( 'id' , ':id' ) ) -> setParamete... | Updates a target . |
44,660 | public function addCondition ( Condition $ condition ) : Condition { $ query = $ this -> connection -> createQueryBuilder ( ) -> insert ( 'ngbm_rule_condition' ) -> values ( [ 'id' => ':id' , 'status' => ':status' , 'rule_id' => ':rule_id' , 'type' => ':type' , 'value' => ':value' , ] ) -> setValue ( 'id' , $ condition... | Adds a condition . |
44,661 | public function updateCondition ( Condition $ condition ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ngbm_rule_condition' ) -> set ( 'rule_id' , ':rule_id' ) -> set ( 'type' , ':type' ) -> set ( 'value' , ':value' ) -> where ( $ query -> expr ( ) -> eq ( 'id' , ':id' ) ) ->... | Updates a condition . |
44,662 | private function getRuleSelectQuery ( ) : QueryBuilder { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'DISTINCT r.*' , 'rd.*' ) -> from ( 'ngbm_rule' , 'r' ) -> innerJoin ( 'r' , 'ngbm_rule_data' , 'rd' , $ query -> expr ( ) -> eq ( 'rd.rule_id' , 'r.id' ) ) ; return $ query ; } | Builds and returns a rule database SELECT query . |
44,663 | private function getTargetSelectQuery ( ) : QueryBuilder { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'DISTINCT ngbm_rule_target.*' ) -> from ( 'ngbm_rule_target' ) ; return $ query ; } | Builds and returns a target database SELECT query . |
44,664 | private function getConditionSelectQuery ( ) : QueryBuilder { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'DISTINCT ngbm_rule_condition.*' ) -> from ( 'ngbm_rule_condition' ) ; return $ query ; } | Builds and returns a condition database SELECT query . |
44,665 | public function getZone ( string $ zoneIdentifier ) : APIZone { if ( $ this -> hasZone ( $ zoneIdentifier ) ) { return $ this -> zones -> get ( $ zoneIdentifier ) ; } throw LayoutException :: noZone ( $ zoneIdentifier ) ; } | Returns the specified zone . |
44,666 | public function validateLayoutCreateStruct ( LayoutCreateStruct $ layoutCreateStruct ) : void { $ layoutName = is_string ( $ layoutCreateStruct -> name ) ? trim ( $ layoutCreateStruct -> name ) : $ layoutCreateStruct -> name ; $ this -> validate ( $ layoutName , [ new Constraints \ NotBlank ( ) , new Constraints \ Type... | Validates the provided layout create struct . |
44,667 | public function validateLayoutUpdateStruct ( LayoutUpdateStruct $ layoutUpdateStruct ) : void { $ layoutName = is_string ( $ layoutUpdateStruct -> name ) ? trim ( $ layoutUpdateStruct -> name ) : $ layoutUpdateStruct -> name ; if ( $ layoutName !== null ) { $ this -> validate ( $ layoutName , [ new Constraints \ NotBla... | Validates the provided layout update struct . |
44,668 | public function validateLayoutCopyStruct ( LayoutCopyStruct $ layoutCopyStruct ) : void { $ layoutName = is_string ( $ layoutCopyStruct -> name ) ? trim ( $ layoutCopyStruct -> name ) : $ layoutCopyStruct -> name ; $ this -> validate ( $ layoutName , [ new Constraints \ NotBlank ( ) , new Constraints \ Type ( [ 'type' ... | Validates the provided layout copy struct . |
44,669 | public function validateChangeLayoutType ( Layout $ layout , LayoutTypeInterface $ targetLayoutType , array $ zoneMappings , bool $ preserveSharedZones = true ) : void { $ seenZones = [ ] ; foreach ( $ zoneMappings as $ newZone => $ oldZones ) { if ( ! $ targetLayoutType -> hasZone ( $ newZone ) ) { throw ValidationExc... | Validates zone mappings for changing the provided layout type . |
44,670 | public function onBuildView ( CollectViewParametersEvent $ event ) : void { $ view = $ event -> getView ( ) ; if ( ! $ view instanceof LayoutViewInterface ) { return ; } if ( $ view -> getContext ( ) !== ViewInterface :: CONTEXT_ADMIN ) { return ; } $ layout = $ view -> getLayout ( ) ; $ relatedLayoutsCount = 0 ; if ( ... | Injects the number of layouts connected to the shared layout provided by the event . |
44,671 | public function fillParametersFromHash ( ConfigDefinitionInterface $ configDefinition , array $ values , bool $ doImport = false ) : void { $ this -> fillFromHash ( $ configDefinition , $ values , $ doImport ) ; } | Fills the parameter values based on provided array of values . |
44,672 | public function onKernelRequest ( GetResponseEvent $ event ) : void { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ request = $ event -> getRequest ( ) ; if ( $ request -> attributes -> get ( '_route' ) !== 'ngbm_ajax_block' ) { return ; } if ( $ request -> attributes -> has ( 'ngbmContextUri' ) ) { return ; }... | Removes the page query parameter from the AJAX block request URI in order to remove the need to hash the page number which greatly simplifies generating URIs to single pages of AJAX block request . |
44,673 | private function getZones ( Layout $ layout , LayoutTypeInterface $ layoutType ) : Generator { foreach ( $ layout as $ zoneIdentifier => $ zone ) { $ linkedZone = $ zone -> getLinkedZone ( ) ; yield [ 'identifier' => $ zoneIdentifier , 'name' => $ this -> getZoneName ( $ zone , $ layoutType ) , 'block_ids' => $ this ->... | Returns the array with layout zones . |
44,674 | private function getZoneName ( Zone $ zone , LayoutTypeInterface $ layoutType ) : string { if ( $ layoutType -> hasZone ( $ zone -> getIdentifier ( ) ) ) { return $ layoutType -> getZone ( $ zone -> getIdentifier ( ) ) -> getName ( ) ; } return $ zone -> getIdentifier ( ) ; } | Returns provided zone name . |
44,675 | private function getAllowedBlocks ( Zone $ zone , LayoutTypeInterface $ layoutType ) { if ( $ layoutType -> hasZone ( $ zone -> getIdentifier ( ) ) ) { $ layoutTypeZone = $ layoutType -> getZone ( $ zone -> getIdentifier ( ) ) ; $ allowedBlockDefinitions = $ layoutTypeZone -> getAllowedBlockDefinitions ( ) ; if ( count... | Returns all allowed block definitions from provided zone or true if all block definitions are allowed . |
44,676 | private function generateBlockTypeGroupConfig ( array $ blockTypeGroups , array $ blockTypes ) : array { $ missingBlockTypes = [ ] ; if ( isset ( $ blockTypeGroups [ 'custom' ] ) ) { foreach ( array_keys ( $ blockTypes ) as $ blockType ) { foreach ( $ blockTypeGroups as $ blockTypeGroup ) { if ( in_array ( $ blockType ... | Generates the block type group configuration from provided block types . |
44,677 | private function buildBlockTypeGroups ( ContainerBuilder $ container , array $ blockTypeGroups , array $ blockTypes ) : Generator { foreach ( $ blockTypeGroups as $ identifier => $ blockTypeGroup ) { $ serviceIdentifier = sprintf ( 'netgen_block_manager.block.block_type_group.%s' , $ identifier ) ; $ blockTypeReference... | Builds the block type group objects from provided configuration . |
44,678 | public function loadBlockData ( $ blockId , int $ status ) : array { $ query = $ this -> getBlockSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'b.id' , ':id' ) ) -> setParameter ( 'id' , $ blockId , Type :: INTEGER ) ; $ this -> applyStatusCondition ( $ query , $ status , 'b.status' ) ; return $ quer... | Loads all block data . |
44,679 | public function loadCollectionReferencesData ( Block $ block , ? string $ identifier = null ) : array { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'block_id' , 'block_status' , 'collection_id' , 'collection_status' , 'identifier' ) -> from ( 'ngbm_block_collection' ) -> where ( $ que... | Loads all collection reference data . |
44,680 | public function loadLayoutBlocksData ( Layout $ layout ) : array { $ query = $ this -> getBlockSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'b.layout_id' , ':layout_id' ) ) -> setParameter ( 'layout_id' , $ layout -> id , Type :: INTEGER ) ; $ this -> applyStatusCondition ( $ query , $ layout -> sta... | Loads all layout block data . |
44,681 | public function loadZoneBlocksData ( Zone $ zone ) : array { $ query = $ this -> getBlockSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> like ( 'b.path' , ':path' ) ) -> setParameter ( 'path' , '%/' . $ zone -> rootBlockId . '/%' , Type :: STRING ) ; $ this -> applyStatusCondition ( $ query , $ zone -> stat... | Loads all zone block data . |
44,682 | public function loadChildBlocksData ( Block $ block , ? string $ placeholder = null ) : array { $ query = $ this -> getBlockSelectQuery ( ) ; $ query -> where ( $ query -> expr ( ) -> eq ( 'b.parent_id' , ':parent_id' ) ) -> setParameter ( 'parent_id' , $ block -> id , Type :: INTEGER ) -> addOrderBy ( 'b.placeholder' ... | Loads all child block data from specified block optionally filtered by placeholder . |
44,683 | public function createBlockTranslation ( Block $ block , string $ locale ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) -> insert ( 'ngbm_block_translation' ) -> values ( [ 'block_id' => ':block_id' , 'status' => ':status' , 'locale' => ':locale' , 'parameters' => ':parameters' , ] ) -> setParamete... | Creates a block translation . |
44,684 | public function createCollectionReference ( CollectionReference $ collectionReference ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> insert ( 'ngbm_block_collection' ) -> values ( [ 'block_id' => ':block_id' , 'block_status' => ':block_status' , 'collection_id' => ':collection_id' , 'c... | Creates the collection reference . |
44,685 | public function updateBlockTranslation ( Block $ block , string $ locale ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ngbm_block_translation' ) -> set ( 'parameters' , ':parameters' ) -> where ( $ query -> expr ( ) -> andX ( $ query -> expr ( ) -> eq ( 'block_id' , ':block_... | Updates a block translation . |
44,686 | public function moveBlock ( Block $ block , Block $ targetBlock , string $ placeholder , int $ position ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ngbm_block' ) -> set ( 'position' , ':position' ) -> set ( 'parent_id' , ':parent_id' ) -> set ( 'placeholder' , ':placeholde... | Moves a block . If the target block is not provided the block is only moved within its current parent ID and placeholder . |
44,687 | public function deleteCollectionReferences ( array $ blockIds , ? int $ status = null ) : void { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> delete ( 'ngbm_block_collection' ) -> where ( $ query -> expr ( ) -> in ( 'block_id' , [ ':block_id' ] ) ) -> setParameter ( 'block_id' , $ blockIds , Co... | Deletes the collection reference . |
44,688 | public function loadSubBlockIds ( $ blockId , ? int $ status = null ) : array { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'DISTINCT id' ) -> from ( 'ngbm_block' ) -> where ( $ query -> expr ( ) -> like ( 'path' , ':path' ) ) -> setParameter ( 'path' , '%/' . ( int ) $ blockId . '/%'... | Loads all sub block IDs . |
44,689 | public function loadLayoutBlockIds ( $ layoutId , ? int $ status = null ) : array { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'DISTINCT id' ) -> from ( 'ngbm_block' ) -> where ( $ query -> expr ( ) -> eq ( 'layout_id' , ':layout_id' ) ) -> setParameter ( 'layout_id' , $ layoutId , T... | Loads all layout block IDs . |
44,690 | public function loadBlockCollectionIds ( array $ blockIds , ? int $ status = null ) : array { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'DISTINCT bc.collection_id' ) -> from ( 'ngbm_block_collection' , 'bc' ) -> where ( $ query -> expr ( ) -> in ( 'bc.block_id' , [ ':block_id' ] ) )... | Loads all block collection IDs . |
44,691 | private function buildViewValues ( iterable $ values , int $ version ) : Generator { foreach ( $ values as $ key => $ value ) { yield $ key => new View ( $ value , $ version ) ; } } | Builds the list of View objects for provided list of values . |
44,692 | public static function buildLayoutType ( string $ identifier , array $ config ) : LayoutTypeInterface { $ zones = [ ] ; foreach ( $ config [ 'zones' ] as $ zoneIdentifier => $ zoneConfig ) { $ zones [ $ zoneIdentifier ] = Zone :: fromArray ( [ 'identifier' => $ zoneIdentifier , 'name' => $ zoneConfig [ 'name' ] , 'allo... | Builds the layout type . |
44,693 | public function validateBlockCreateStruct ( BlockCreateStruct $ blockCreateStruct ) : void { $ this -> validate ( $ blockCreateStruct , [ new BlockCreateStructConstraint ( ) , ] ) ; $ this -> validate ( $ blockCreateStruct , new ConfigAwareStructConstraint ( [ 'payload' => $ blockCreateStruct -> getDefinition ( ) , ] )... | Validates the provided block create struct . |
44,694 | public function validateBlockUpdateStruct ( Block $ block , BlockUpdateStruct $ blockUpdateStruct ) : void { $ this -> validate ( $ blockUpdateStruct , [ new BlockUpdateStructConstraint ( [ 'payload' => $ block , ] ) , ] ) ; $ this -> validate ( $ blockUpdateStruct , new ConfigAwareStructConstraint ( [ 'payload' => $ b... | Validates the provided block update struct . |
44,695 | public function isValidQueryType ( string $ queryType ) : bool { if ( ! is_array ( $ this -> validQueryTypes ) ) { return true ; } return in_array ( $ queryType , $ this -> validQueryTypes , true ) ; } | Returns if the provided query type is valid . |
44,696 | public function isValidItemType ( string $ itemType ) : bool { if ( ! is_array ( $ this -> validItemTypes ) ) { return true ; } return in_array ( $ itemType , $ this -> validItemTypes , true ) ; } | Returns if the provided item type is valid . |
44,697 | public function newCollectionCreateStruct ( ? QueryCreateStruct $ queryCreateStruct = null ) : CollectionCreateStruct { $ struct = new CollectionCreateStruct ( ) ; $ struct -> queryCreateStruct = $ queryCreateStruct ; return $ struct ; } | Creates a new collection create struct . |
44,698 | public function newCollectionUpdateStruct ( ? Collection $ collection = null ) : CollectionUpdateStruct { $ collectionUpdateStruct = new CollectionUpdateStruct ( ) ; if ( $ collection !== null ) { $ collectionUpdateStruct -> offset = $ collection -> getOffset ( ) ; $ collectionUpdateStruct -> limit = $ collection -> ge... | Creates a new collection update struct . |
44,699 | public function newItemCreateStruct ( ItemDefinitionInterface $ itemDefinition , $ value ) : ItemCreateStruct { $ struct = new ItemCreateStruct ( ) ; $ struct -> definition = $ itemDefinition ; $ struct -> value = $ value ; return $ struct ; } | Creates a new item create struct from provided values . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.