idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
44,100 | public function removeOrphanPromotionFromSku ( SKU $ sku , int $ nid ) { $ promotion_detach_item [ ] = [ 'target_id' => $ nid ] ; $ sku_promotions = $ sku -> get ( 'field_acm_sku_promotions' ) -> getValue ( ) ; $ sku_promotions = array_udiff ( $ sku_promotions , $ promotion_detach_item , function ( $ array1 , $ array2 ... | Removes the given promotion from SKU entity . |
44,101 | public function onException ( RouteExceptionEvent $ event ) { $ exception = $ event -> getException ( ) ; $ handler = \ Drupal :: service ( 'acm_exception.route_exception_handler' ) ; $ handler -> message ( $ exception ) ; $ handler -> log ( $ exception ) ; } | User messaging for RouteExceptions . |
44,102 | private function handleNotification ( Notification $ notification ) { if ( empty ( $ notification -> targetTypes ( ) ) ) { return ; } $ objectsByTypes = [ ] ; $ numTotal = 0 ; foreach ( $ notification -> targetTypes ( ) as $ objType ) { $ objType = trim ( $ objType ) ; $ objects = $ this -> updatedObjects ( $ objType )... | Handle a notification request |
44,103 | public function onException ( GetResponseForExceptionEvent $ event ) { $ exception = $ event -> getException ( ) ; if ( ! ( $ exception instanceof RouteException ) || PHP_SAPI === 'cli' ) { return ; } $ handler = \ Drupal :: service ( 'acm_exception.route_exception_handler' ) ; $ redirect = $ handler -> getRedirect ( $... | Catch all uncaught RouteException exceptions . |
44,104 | public function updateNodeTranslation ( NodeInterface & $ node , array $ product , string $ langcode ) { $ description = ( isset ( $ product [ 'attributes' ] [ 'description' ] ) ) ? $ product [ 'attributes' ] [ 'description' ] : '' ; $ categories = ( isset ( $ product [ 'categories' ] ) ) ? $ product [ 'categories' ] :... | Update node translation . |
44,105 | private function updateLinkedSkus ( $ type , SKU & $ sku , array $ linked ) { $ sku -> { $ type } -> setValue ( [ ] ) ; $ fieldData = [ ] ; foreach ( $ linked as $ link ) { if ( $ link [ 'type' ] != $ type ) { continue ; } $ fieldData [ $ link [ 'position' ] ] = $ link [ 'linked_sku' ] ; } if ( empty ( $ fieldData ) ) ... | Update linked Skus . |
44,106 | private function updateFields ( $ parent , SKU $ sku , array $ values ) { $ additionalFields = $ this -> skuFieldsManager -> getFieldAdditions ( ) ; $ additionalFields = array_filter ( $ additionalFields , function ( $ field ) use ( $ parent ) { return ( $ field [ 'parent' ] == $ parent ) ; } ) ; foreach ( $ additional... | Update attribute fields . |
44,107 | protected function getProcessedMedia ( array $ product , $ current_value ) { $ media = [ ] ; if ( isset ( $ product [ 'extension' ] , $ product [ 'extension' ] [ 'media' ] , $ product [ 'extension' ] [ 'media' ] [ 0 ] ) ) { $ media = reset ( $ product [ 'extension' ] [ 'media' ] ) ; if ( isset ( $ product [ 'attributes... | Extracts and orders the media gallery by position and sets the main image . |
44,108 | public function choices ( ) { $ choices = [ ] ; $ proto = $ this -> proto ( ) ; if ( ! $ proto -> source ( ) -> tableExists ( ) ) { return $ choices ; } $ loader = $ this -> collectionModelLoader ( ) ; $ collection = new HierarchicalCollection ( $ loader -> load ( ) , false ) ; $ collection -> setPage ( $ loader -> pag... | Retrieve the available choice structures segmented as a tree . |
44,109 | public function feedbacks ( $ level = null ) { if ( $ level !== null ) { if ( ! is_string ( $ level ) ) { throw new InvalidArgumentException ( 'The feedback level must be a string' ) ; } $ level = $ this -> resolveFeedbackLevel ( $ level ) ; $ subset = [ ] ; foreach ( $ this -> feedbacks as $ item ) { if ( $ item [ 'le... | Retrieve the feedback collection . |
44,110 | final protected function parseFeedback ( array $ entry ) { $ fid = $ this -> generateFeedbackEntryId ( ) ; $ entry [ 'id' ] = $ fid ; $ entry = $ this -> parseFeedbackEntry ( $ entry ) ; if ( empty ( $ entry [ 'id' ] ) || $ entry [ 'id' ] !== $ fid ) { throw new UnexpectedValueException ( 'The unique ID assigned to the... | Parse a feedback entry . |
44,111 | public function message ( RouteException $ e ) { $ message = $ this -> getConfig ( 'message' , $ e ) ; if ( ! empty ( $ message ) && PHP_SAPI !== 'cli' ) { drupal_set_message ( $ message , 'error' ) ; } } | Present the error message for this RouteException to the user . |
44,112 | public function log ( RouteException $ e ) { if ( empty ( $ this -> getConfig ( 'log' , $ e ) ) ) { return ; } $ this -> logger -> critical ( "Exception thrown during the {$e->getOperation()} operation.<br /><strong>Response code:</strong> {$e->getCode()}<br /><strong>Response body:</strong><pre>{$e->getMessage()}</pre... | Generate a log message . |
44,113 | public function getRedirect ( RouteException $ e ) { $ redirect = $ this -> getConfig ( 'redirect' , $ e ) ; if ( empty ( $ redirect ) ) { $ redirect = '<current>' ; } return Url :: fromUri ( "internal:/{$redirect}" ) -> toString ( ) ; } | Get the exception redirect from storage . |
44,114 | private function getConfig ( $ key , RouteException $ e ) { $ scenario = $ e -> getOperation ( ) ; $ default = $ this -> config -> get ( "default.{$key}" ) ; $ scenario = $ this -> config -> get ( "routes.{$scenario}.{$key}" ) ; foreach ( [ $ scenario , $ default ] as $ candidate ) { if ( ! empty ( trim ( $ candidate )... | Fetch config for a given RouteException . |
44,115 | public static function processAcmTitleSelect ( array $ element ) { $ element [ '#options' ] = [ 'Mr' => t ( 'Mr' ) , 'Mrs' => t ( 'Mrs' ) , 'Ms' => t ( 'Ms' ) , 'Miss' => t ( 'Miss' ) , 'Dr' => t ( 'Dr' ) , 'Prof.' => t ( 'Prof.' ) , 'Brigadier' => t ( 'Brigadier' ) , 'Reverend' => t ( 'Reverend' ) , ] ; return $ eleme... | Adds in an option list of applicable titles . |
44,116 | public function getSupervisorByKey ( $ key ) { if ( isset ( $ this -> supervisors [ $ key ] ) ) { return $ this -> supervisors [ $ key ] ; } return null ; } | Get Supervisor by key |
44,117 | public static function configurableAjaxCallback ( array $ form , FormStateInterface $ form_state ) { $ dynamic_parts = & $ form [ 'ajax' ] ; $ configurables = $ form_state -> getValue ( 'configurables' ) ; $ helper = \ Drupal :: service ( 'acm_sku.cart_form_helper' ) ; $ tree = $ form_state -> get ( 'tree' ) ; $ tree_p... | Updates the form based on selections . |
44,118 | public function deriveProductTree ( SKU $ sku ) { static $ cache = [ ] ; if ( isset ( $ cache [ $ sku -> language ( ) -> getId ( ) ] , $ cache [ $ sku -> language ( ) -> getId ( ) ] [ $ sku -> id ( ) ] ) ) { return $ cache [ $ sku -> language ( ) -> getId ( ) ] [ $ sku -> id ( ) ] ; } $ tree = [ 'parent' => $ sku , 'pr... | Builds a display tree . |
44,119 | public static function recursiveConfigurableTree ( array & $ tree , array $ available_config , array $ current_config = [ ] ) { $ subtree = [ '#available_config' => $ available_config ] ; foreach ( $ available_config as $ id => $ config ) { $ subtree_available_config = $ available_config ; unset ( $ subtree_available_c... | Creates subtrees based on available config . |
44,120 | public static function findProductInTreeWithConfig ( array $ tree , array $ config ) { if ( isset ( $ tree [ 'products' ] ) ) { $ attributes = [ ] ; foreach ( $ config as $ key => $ value ) { $ attributes [ $ key ] = $ value ; } foreach ( $ tree [ 'combinations' ] [ 'by_sku' ] ?? [ ] as $ sku => $ sku_attributes ) { if... | Finds product in tree base on config . |
44,121 | public function getAttributeValue ( $ sku , $ key ) { $ id = $ sku instanceof SKUInterface ? $ sku -> id ( ) : $ sku ; $ query = \ Drupal :: database ( ) -> select ( 'acm_sku__attributes' , 'acm_sku__attributes' ) ; $ query -> addField ( 'acm_sku__attributes' , 'attributes_value' ) ; $ query -> condition ( "acm_sku__at... | Get attribute value from key - value field . |
44,122 | protected function extractConfigurableOptions ( $ attribute_set , array $ configurable_options ) { $ helper = \ Drupal :: service ( 'acm_sku.cart_form_helper' ) ; $ existing_options = $ helper -> getConfigurableAttributeWeights ( $ attribute_set ) ; foreach ( $ configurable_options as $ configurable ) { $ existing_opti... | Extract configurable options . |
44,123 | public static function sortConfigOptions ( array & $ options , $ attribute_code ) { $ sorted_options = [ ] ; $ query = \ Drupal :: database ( ) -> select ( 'taxonomy_term_field_data' , 'ttfd' ) ; $ query -> fields ( 'ttfd' , [ 'tid' , 'weight' ] ) ; $ query -> join ( 'taxonomy_term__field_sku_attribute_code' , 'ttfsac'... | Helper function to sort config options based on taxonomy term weight . |
44,124 | public static function getChildren ( SKU $ sku ) { $ children = [ ] ; foreach ( $ sku -> get ( 'field_configured_skus' ) -> getValue ( ) as $ child ) { if ( empty ( $ child [ 'value' ] ) ) { continue ; } $ child_sku = SKU :: loadFromSku ( $ child [ 'value' ] ) ; if ( $ child_sku instanceof SKU ) { $ children [ $ child_... | Wrapper function to get available children for a configurable SKU . |
44,125 | protected function getSkuFieldName ( $ node_type ) { $ fields = $ this -> entityFieldManager -> getFieldDefinitions ( 'node' , $ node_type ) ; $ sku_field_name = FALSE ; foreach ( $ fields as $ field_name => $ field_instance ) { $ field_type = $ field_instance -> getType ( ) ; if ( $ field_type == 'sku' ) { $ sku_field... | Gets the SKU field on a given node type . |
44,126 | protected function getCategoryFieldName ( $ node_type , $ vid ) { $ fields = $ this -> entityFieldManager -> getFieldDefinitions ( 'node' , $ node_type ) ; $ category_field_name = FALSE ; foreach ( $ fields as $ field_name => $ field_instance ) { $ field_type = $ field_instance -> getType ( ) ; if ( $ field_type != 'en... | Gets the field used to store the category on a given node type . |
44,127 | public function getFilterFormats ( ) { $ options = [ ] ; $ formats = filter_formats ( $ this -> currentUser ) ; foreach ( $ formats as $ format ) { $ options [ $ format -> id ( ) ] = $ format -> label ( ) ; } return $ options ; } | Get all filter formats available to the user . |
44,128 | public function propertyDisplayFactory ( ) { if ( ! isset ( $ this -> propertyDisplayFactory ) ) { throw new RuntimeException ( sprintf ( 'Property Display Factory is not defined for "%s"' , get_class ( $ this ) ) ) ; } return $ this -> propertyDisplayFactory ; } | Retrieve the property display factory . |
44,129 | protected function getPaneConfiguration ( $ pane_id ) { $ pane_configuration = [ ] ; if ( isset ( $ this -> configuration [ 'panes' ] [ $ pane_id ] ) ) { $ pane_configuration = $ this -> configuration [ 'panes' ] [ $ pane_id ] ; } return $ pane_configuration ; } | Gets the configuration for the given pane . |
44,130 | public function setDisplay ( $ display ) { if ( $ display === null ) { $ this -> display = null ; return $ this ; } if ( ! is_string ( $ display ) ) { throw new InvalidArgumentException ( sprintf ( 'Layout must be a string, received %s' , ( is_object ( $ display ) ? get_class ( $ display ) : gettype ( $ display ) ) ) )... | Set the property s display layout . |
44,131 | public function displays ( ) { $ supported = $ this -> supportedDisplayLayouts ( ) ; $ displays = [ ] ; foreach ( $ supported as $ display ) { $ displays [ $ display ] = ( $ display === $ this -> display ( ) ) ; } return $ displays ; } | Retrieve the display layouts ; for templating . |
44,132 | public function synPromotions ( array $ options = [ 'types' => NULL ] ) { if ( $ types = $ options [ 'types' ] ) { $ this -> logger -> notice ( dt ( 'Synchronizing all @types commerce promotions, this usually takes some time...' , [ '@types' => $ types ] ) ) ; $ types = explode ( ',' , $ types ) ; $ types = array_map (... | Run a full synchronization of all commerce promotion records . |
44,133 | public function searchWidget ( ) { $ widget = $ this -> widgetFactory ( ) -> create ( SearchWidget :: class ) ; $ widget -> setObjType ( $ this -> objType ( ) ) ; $ listIdent = $ this -> metadataListIdent ( ) ; $ widget -> setCollectionIdent ( $ listIdent ) ; return $ widget ; } | Sets the search widget accodingly Uses the default_search_list ident that should point on ident in the lists |
44,134 | public function dataFromObject ( ) { $ obj = $ this -> proto ( ) ; $ metadata = $ obj -> metadata ( ) ; $ adminMetadata = isset ( $ metadata [ 'admin' ] ) ? $ metadata [ 'admin' ] : null ; $ collectionIdent = $ this -> collectionIdent ( ) ; if ( ! $ collectionIdent ) { $ collectionIdent = isset ( $ adminMetadata [ 'def... | Fetch metadata from current obj_type |
44,135 | public function propertiesIdents ( ) { $ metadata = $ this -> proto ( ) -> metadata ( ) ; if ( isset ( $ metadata [ 'admin' ] [ 'lists' ] ) ) { $ adminMetadata = $ metadata [ 'admin' ] ; $ collectionIdent = $ this -> collectionIdent ( ) ; if ( isset ( $ adminMetadata [ 'lists' ] [ $ collectionIdent ] [ 'properties' ] )... | Retrieve the property keys to search in the collection . |
44,136 | protected function parseActions ( array $ actions , $ renderer = false ) { $ this -> actionsPriority = $ this -> defaultActionPriority ( ) ; $ parsedActions = [ ] ; foreach ( $ actions as $ ident => $ action ) { $ ident = $ this -> parseActionIdent ( $ ident , $ action ) ; $ action = $ this -> parseActionItem ( $ actio... | Parse the given UI actions . |
44,137 | protected function getActionRenderer ( ) { $ obj = null ; if ( $ this instanceof FormSidebarInterface ) { if ( $ this -> form ( ) ) { $ obj = $ this -> form ( ) -> obj ( ) ; } } if ( $ this instanceof ObjectContainerInterface ) { $ obj = $ this -> obj ( ) ; } if ( $ this instanceof CollectionContainerInterface ) { $ ob... | Fetch a viewable instance to process an action s renderables . |
44,138 | protected function parseActionCondition ( $ condition , $ action = null , $ renderer = null ) { unset ( $ action ) ; if ( $ renderer === null ) { $ renderer = $ this -> getActionRenderer ( ) ; } if ( is_bool ( $ condition ) ) { return $ condition ; } elseif ( is_string ( $ condition ) ) { $ not = ( $ condition [ 0 ] ==... | Parse the given UI action conditional check . |
44,139 | protected function parseActionUrl ( $ url , $ action = null , $ renderer = null ) { unset ( $ action ) ; if ( $ renderer === null ) { $ renderer = $ this -> getActionRenderer ( ) ; } if ( $ url instanceof Translation ) { $ url = ( string ) $ url ; } $ url = trim ( $ url ) ; if ( empty ( $ url ) && ! is_numeric ( $ url ... | Parse the given UI action URL . |
44,140 | protected function parseActionCssClasses ( $ classes , $ action = null , $ renderer = null ) { if ( $ renderer === null ) { $ renderer = $ this -> getActionRenderer ( ) ; } if ( is_string ( $ classes ) ) { $ classes = explode ( ' ' , $ classes ) ; } elseif ( ! is_array ( $ classes ) ) { $ classes = [ ] ; } $ classes [ ... | Parse the given UI action CSS classes . |
44,141 | protected function defaultActionStruct ( ) { return [ 'ident' => null , 'priority' => null , 'permissions' => [ ] , 'condition' => null , 'active' => true , 'empty' => false , 'label' => null , 'showLabel' => true , 'icon' => null , 'url' => null , 'name' => null , 'value' => null , 'target' => null , 'isText' => false... | Retrieve the default action structure . |
44,142 | protected function compareActions ( array $ a , array $ b ) { $ a = isset ( $ a [ 'priority' ] ) ? $ a [ 'priority' ] : 0 ; $ b = isset ( $ b [ 'priority' ] ) ? $ b [ 'priority' ] : 0 ; $ c = isset ( $ action [ 'isSubmittable' ] ) && $ action [ 'isSubmittable' ] ; return ( $ c || ( $ a === 0 ) || ( $ a >= $ b ) ) ; } | To be called when merging actions . |
44,143 | public function defaults ( ) { $ baseDir = rtrim ( realpath ( __DIR__ . '/../../../' ) , '/' ) ; $ confDir = $ baseDir . '/config' ; return $ this -> loadFile ( $ confDir . '/admin.config.default.json' ) ; } | The default data is defined in a JSON file . |
44,144 | public function setBasePath ( $ path ) { if ( ! is_string ( $ path ) ) { throw new InvalidArgumentException ( 'Path must be a string' ) ; } if ( $ path == '' ) { throw new InvalidArgumentException ( 'Path can not be empty' ) ; } $ this -> basePath = $ path ; return $ this ; } | Set the admin module s route group . |
44,145 | public function setRoutes ( array $ routes ) { $ toIterate = RouteConfig :: defaultRouteTypes ( ) ; foreach ( $ routes as $ key => $ val ) { if ( in_array ( $ key , $ toIterate ) && isset ( $ this -> routes [ $ key ] ) ) { $ this -> routes [ $ key ] = array_merge ( $ this -> routes [ $ key ] , $ val ) ; } else { $ this... | Parse the admin module s route configuration . |
44,146 | public function setHandlers ( array $ handlers ) { $ this -> handlers = array_fill_keys ( HandlerConfig :: defaultHandlerTypes ( ) , [ ] ) ; $ this -> handlers [ 'defaults' ] = [ ] ; foreach ( $ handlers as $ handler => $ data ) { $ this -> handlers [ $ handler ] = array_replace ( $ this -> handlers [ $ handler ] , $ d... | Define custom response and error handlers . |
44,147 | public function setLat ( $ coord ) { if ( $ coord === null ) { $ this -> lat = $ coord ; return $ this ; } if ( ! is_numeric ( $ coord ) ) { throw new InvalidArgumentException ( 'The "lat" must be a number' ) ; } $ this -> lat = ( float ) $ coord ; return $ this ; } | Set the latitude for the widget . |
44,148 | public function lat ( ) { if ( $ this -> lat !== null ) { return $ this -> lat ; } if ( ! $ this -> hasObj ( ) || ! $ this -> latProperty ( ) ) { return null ; } return $ this -> obj ( ) [ $ this -> latProperty ( ) ] ; } | Retrieve the latitude from the object s latitude property . |
44,149 | public function setLng ( $ coord ) { if ( $ coord === null ) { $ this -> lng = $ coord ; return $ this ; } if ( ! is_numeric ( $ coord ) ) { throw new InvalidArgumentException ( 'The "lng" must be a number' ) ; } $ this -> lng = ( float ) $ coord ; return $ this ; } | Set the longitude of the object s geolocation . |
44,150 | public function lng ( ) { if ( $ this -> lng !== null ) { return $ this -> lng ; } if ( ! $ this -> hasObj ( ) || ! $ this -> lngProperty ( ) ) { return null ; } return $ this -> obj ( ) [ $ this -> lngProperty ( ) ] ; } | Retrieve the longitude from the object s longitude property . |
44,151 | public function hasObj ( ) { if ( $ this -> obj === null ) { try { $ this -> obj ( ) ; } catch ( InvalidArgumentException $ e ) { return false ; } } return ! empty ( $ this -> obj ) ; } | Determine if the widget has a related object . |
44,152 | public function obj ( ) { if ( $ this -> obj === null ) { $ objId = filter_input ( INPUT_GET , 'obj_id' , FILTER_SANITIZE_STRING ) ; $ objType = filter_input ( INPUT_GET , 'obj_type' , FILTER_SANITIZE_STRING ) ; if ( $ objId && $ objType ) { $ obj = $ this -> modelFactory ( ) -> create ( $ objType ) ; $ obj -> load ( $... | Retrieve the widget s related object . |
44,153 | public static function processPasswordUpdate ( & $ element , FormStateInterface $ form_state , & $ complete_form ) { $ element [ 'oldpass' ] = [ '#type' => 'password' , '#title' => t ( 'Old Password' ) , '#value' => empty ( $ element [ '#value' ] ) ? NULL : $ element [ '#value' ] [ 'oldpass' ] , '#required' => $ elemen... | Expand an acm_password_update field into three text boxes . |
44,154 | public function languages ( ) { $ currentLocale = $ this -> translator ( ) -> getLocale ( ) ; $ languages = [ ] ; foreach ( $ this -> translator ( ) -> locales ( ) as $ locale => $ localeStruct ) { if ( isset ( $ localeStruct [ 'name' ] ) ) { $ label = $ this -> translator ( ) -> translation ( $ localeStruct [ 'name' ]... | Retrieve the available languages formatted for the sidebar language - switcher . |
44,155 | public function addFeedbackFromValidation ( ModelInterface $ obj , $ filters = null ) { $ validator = $ obj -> validator ( ) ; $ levels = [ ModelValidator :: ERROR , ModelValidator :: WARNING , ModelValidator :: NOTICE ] ; if ( is_string ( $ filters ) && in_array ( $ filters , $ levels ) ) { $ results = call_user_func ... | Merge the given object s validation results the response feedback . |
44,156 | protected function formGroupFactory ( ) { if ( $ this -> formGroupFactory === null ) { throw new RuntimeException ( sprintf ( 'Form Group Factory is not defined for "%s"' , get_class ( $ this ) ) ) ; } return $ this -> formGroupFactory ; } | Retrieve the form group factory . |
44,157 | public function handleHeartbeat ( ) { $ fp = @ fopen ( "ssh2.sftp://" . $ this -> resource . "/." , "r" ) ; if ( ! $ fp || ! is_resource ( $ fp ) ) { return $ this -> ssh2 -> disconnect ( ) ; } fclose ( $ fp ) ; $ this -> handleData ( ) ; } | Determine whether connection is still open . |
44,158 | public function handleData ( ) { if ( $ this -> paused || $ this -> resourcesCounter === 0 ) { return ; } foreach ( $ this -> resources as $ resource ) { if ( ! $ resource -> isPaused ( ) && $ resource -> isReadable ( ) ) { $ resource -> handleRead ( ) ; } } foreach ( $ this -> resources as $ resource ) { if ( ! $ reso... | Handle data . |
44,159 | private function removeResource ( $ prefix ) { if ( ! isset ( $ this -> resources [ $ prefix ] ) ) { return ; } unset ( $ this -> resources [ $ prefix ] ) ; $ this -> resourcesCounter -- ; if ( $ this -> resourcesCounter === 0 ) { $ this -> pause ( ) ; } } | Remove resource from known collection . |
44,160 | protected function parseChoiceVal ( $ value ) { if ( $ value instanceof ModelInterface ) { $ value = $ value -> id ( ) ; } if ( $ value instanceof Closure ) { $ value = $ value ( ) ; } if ( $ value instanceof DateTimeInterface ) { $ value = $ value -> format ( 'Y-m-d-H:i' ) ; } if ( method_exists ( $ value , '__toStrin... | Convert the value to a scalar . |
44,161 | public function parsedVal ( ) { if ( ! isset ( $ this -> parsedVal [ $ this -> lang ( ) ] ) ) { $ val = $ this -> propertyVal ( ) ; if ( $ val === null ) { return null ; } $ val = $ this -> p ( ) -> parseVal ( $ val ) ; if ( isset ( $ val [ $ this -> lang ( ) ] ) ) { $ val = $ val [ $ this -> lang ( ) ] ; } if ( ! is_a... | Keep parsed val in memory per lang |
44,162 | public function isChoiceSelected ( $ choice ) { $ val = $ this -> parsedVal ( ) ; if ( $ val === null ) { return false ; } if ( isset ( $ choice [ 'value' ] ) ) { $ choice = $ choice [ 'value' ] ; } if ( $ this -> p ( ) -> multiple ( ) ) { return in_array ( $ choice , $ val ) ; } else { return $ choice == $ val ; } } | Determine if the provided option is a selected value . |
44,163 | public function setEmptyChoice ( $ choice ) { if ( is_string ( $ choice ) || ( $ choice instanceof Translation ) ) { $ choice = [ 'label' => $ choice ] ; } if ( is_array ( $ choice ) ) { $ choice = array_replace_recursive ( $ this -> defaultEmptyChoice ( ) , $ choice ) ; } else { throw new InvalidArgumentException ( sp... | Set the empty option s structure . |
44,164 | public function mapObjToChoice ( $ obj ) { $ map = $ this -> choiceObjMap ( ) ; $ choice = [ ] ; foreach ( $ map as $ key => $ props ) { $ choice [ $ key ] = null ; $ props = explode ( ':' , $ props ) ; foreach ( $ props as $ prop ) { $ choice [ $ key ] = $ this -> renderChoiceObjMap ( $ obj , $ prop ) ; break ; } } re... | Convert the given object into a choice structure . |
44,165 | public function secondaryMenu ( ) { if ( $ this -> secondaryMenu === null ) { $ this -> secondaryMenu = $ this -> createSecondaryMenu ( 'system' ) ; } return $ this -> secondaryMenu ; } | Retrieve the secondary menu . |
44,166 | private function formatTimeDiff ( DateTimeInterface $ date1 , DateTimeInterface $ date2 = null ) { $ isNow = $ date2 === null ; if ( $ isNow ) { $ date2 = new DateTime ( 'now' , $ date1 -> getTimezone ( ) ) ; } $ interval = $ date1 -> diff ( $ date2 ) ; $ translator = $ this -> translator ( ) ; switch ( true ) { case (... | Human - readable time difference . |
44,167 | public function pluginFromSku ( SKU $ sku ) { if ( empty ( $ sku ) ) { return NULL ; } $ bundle = $ sku -> getType ( ) ; if ( empty ( $ bundle ) ) { return NULL ; } $ plugin = NULL ; try { $ plugin = $ this -> getDefinition ( $ bundle ) ; } catch ( PluginNotFoundException $ exception ) { \ Drupal :: logger ( 'acm_sku' ... | Takes a SKU entity and checks it for a matching plugin . |
44,168 | public function pluginInstanceFromType ( $ type ) { $ plugin = NULL ; try { $ plugin = $ this -> getDefinition ( $ type ) ; $ plugin = $ this -> createInstance ( $ plugin [ 'id' ] ) ; } catch ( \ Exception $ exception ) { \ Drupal :: logger ( 'acm_sku' ) -> notice ( t ( "Bundle @bundle doesn't appear to have an ... | Takes a type and checks it for a matching plugin . |
44,169 | public function formPage ( $ action = NULL , $ id = NULL ) { $ plugin = $ this -> customerPagesManager -> createInstance ( $ this -> customerPagesPlugin , [ 'action' => $ action , 'id' => $ id ] ) ; $ form_state = new FormState ( ) ; $ form = $ this -> formBuilder -> buildForm ( $ plugin , $ form_state ) ; $ form [ '#a... | Renders a customer page . |
44,170 | protected function groupsConditionalLogic ( array $ groups = null ) { if ( ! $ groups ) { $ groups = iterator_to_array ( $ this -> groups ( ) ) ; } $ conditions = [ ] ; foreach ( $ groups as $ group ) { if ( $ group instanceof FormInterface ) { $ groupGroups = iterator_to_array ( $ group -> groups ( ) ) ; if ( ! empty ... | Self recursive when a groups is an instance of FormInterface . |
44,171 | public function widgetId ( ) { if ( ! $ this -> widgetId ) { $ type = $ this -> type ( ) ; switch ( $ type ) { case static :: PROPERTY_DISPLAY : $ id = $ this -> display ( ) -> displayId ( ) ; break ; case static :: PROPERTY_CONTROL : $ id = $ this -> input ( ) -> inputId ( ) ; break ; default : $ id = 'widget_' . uniq... | Retrieve the widget ID . |
44,172 | public function setType ( $ type ) { if ( empty ( $ type ) ) { $ this -> type = null ; return $ this ; } if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'Form property widget type must be a string' ) ; } if ( $ this -> propertyFactory ( ) -> isResolvable ( $ type ) ) { $ this -> setPropertyType ( $... | Set the widget or property type . |
44,173 | public function outputType ( ) { if ( $ this -> outputType === null ) { if ( $ this -> inputType === false && $ this -> displayType === false ) { throw new LogicException ( 'Form property widget requires an "input_type" or a "display_type"' ) ; } $ type = null ; if ( $ this -> inputType === false || is_string ( $ this ... | Retrieve the widget s property output type . |
44,174 | public function setData ( array $ data ) { $ this -> isMergingWidgetData = true ; $ data = $ this -> setCoreData ( $ data ) ; parent :: setData ( $ data ) ; $ this -> setPropertyData ( $ data ) ; $ this -> isMergingWidgetData = false ; return $ this ; } | Set the widget and property data . |
44,175 | public function merge ( array $ data ) { $ this -> isMergingWidgetData = true ; $ data = $ this -> setCoreData ( $ data ) ; $ this -> mergePropertyData ( $ data ) ; $ this -> isMergingWidgetData = false ; return $ this ; } | Merge widget and property data . |
44,176 | public function setPropertyData ( array $ data ) { $ this -> propertyData = $ data ; if ( ! $ this -> isMergingWidgetData ) { $ this -> setCoreData ( $ this -> propertyData ) ; } if ( $ this -> property ) { $ this -> property -> setData ( $ data ) ; } return $ this ; } | Set the property metadata . |
44,177 | public function mergePropertyData ( array $ data ) { $ this -> propertyData = array_replace ( $ this -> propertyData , $ data ) ; if ( ! $ this -> isMergingWidgetData ) { $ this -> setCoreData ( $ this -> propertyData ) ; } if ( $ this -> property ) { $ this -> property -> setData ( $ data ) ; } return $ this ; } | Merge the property metadata . |
44,178 | public function showLabel ( ) { if ( $ this -> showLabel === null ) { $ prop = $ this -> property ( ) ; $ show = $ prop [ 'show_label' ] ; if ( $ show !== null ) { $ this -> showLabel = $ show ; } else { $ this -> showLabel = true ; } } if ( $ this -> showLabel !== false ) { return ! ! strval ( $ this -> property ( ) -... | Determine if the label is to be displayed . |
44,179 | public function showDescription ( ) { if ( $ this -> showDescription === null ) { $ prop = $ this -> property ( ) ; $ show = $ prop [ 'show_description' ] ; if ( $ show !== null ) { $ this -> showDescription = $ show ; } else { $ this -> showDescription = true ; } } if ( $ this -> showDescription !== false ) { return !... | Determine if the description is to be displayed . |
44,180 | public function showNotes ( ) { if ( $ this -> showNotes === null ) { $ prop = $ this -> property ( ) ; $ show = $ prop [ 'show_notes' ] ; if ( $ show !== null ) { $ this -> showNotes = $ show ; } else { $ this -> showNotes = true ; } } if ( $ this -> showNotes !== false ) { return ! ! strval ( $ this -> property ( ) -... | Determine if the notes is to be displayed . |
44,181 | public function setInputType ( $ type ) { if ( empty ( $ type ) ) { $ this -> inputType = null ; return $ this ; } if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'Property input type must be a string' ) ; } $ this -> inputType = $ type ; return $ this ; } | Set the property control type . |
44,182 | public function inputType ( ) { if ( $ this -> inputType === null ) { $ this -> inputType = $ this -> resolveInputType ( ) ; } return $ this -> inputType ; } | Retrieve the property control type . |
44,183 | public function setDisplayType ( $ type ) { if ( empty ( $ type ) ) { $ this -> displayType = null ; return $ this ; } if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'Property display type must be a string' ) ; } $ this -> displayType = $ type ; return $ this ; } | Set the property display type . |
44,184 | public function displayType ( ) { if ( $ this -> displayType === null ) { $ this -> displayType = $ this -> resolveDisplayType ( ) ; } return $ this -> displayType ; } | Retrieve the property display type . |
44,185 | public function setProperty ( PropertyInterface $ property ) { $ this -> property = $ property ; $ this -> propertyType = $ property -> type ( ) ; $ this -> propertyIdent = $ property -> ident ( ) ; $ inputType = $ property [ 'input_type' ] ; if ( $ inputType ) { $ this -> inputType = $ inputType ; } $ displayType = $ ... | Set the widget s model property . |
44,186 | public function property ( ) { if ( $ this -> property === null ) { $ this -> property = $ this -> createProperty ( ) ; } return $ this -> property ; } | Retrieve the widget s model property . |
44,187 | public function showActiveLanguage ( ) { $ property = $ this -> property ( ) ; $ locales = count ( $ this -> translator ( ) -> availableLocales ( ) ) ; return ( $ locales > 1 && $ property -> l10n ( ) ) ; } | Determine if the form control s active language should be displayed . |
44,188 | public function inputNameAsCssClass ( ) { $ name = str_replace ( [ ']' , '[' ] , [ '' , '-' ] , $ this -> propertyIdent ( ) ) ; $ name = $ this -> camelize ( $ name ) ; return $ name ; } | Generate a CSS class name for the property s input name . |
44,189 | public function input ( ) { if ( $ this -> inputProperty === null ) { $ this -> inputProperty = $ this -> createInputProperty ( ) ; } return $ this -> inputProperty ; } | Retrieve the form control property . |
44,190 | public function display ( ) { if ( $ this -> displayProperty === null ) { $ this -> displayProperty = $ this -> createDisplayProperty ( ) ; } return $ this -> displayProperty ; } | Retrieve the display property . |
44,191 | public function output ( ) { $ output = $ this -> outputType ( ) ; switch ( $ output ) { case static :: PROPERTY_DISPLAY : $ type = $ this -> displayType ( ) ; $ prop = $ this -> display ( ) ; $ getter = 'displayId' ; $ setter = 'setDisplayId' ; break ; case static :: PROPERTY_CONTROL : $ type = $ this -> inputType ( )... | Yield the property output . |
44,192 | protected function setDependencies ( Container $ container ) { parent :: setDependencies ( $ container ) ; $ this -> setView ( $ container [ 'view' ] ) ; $ this -> setPropertyFactory ( $ container [ 'property/factory' ] ) ; $ this -> setPropertyInputFactory ( $ container [ 'property/input/factory' ] ) ; $ this -> setPr... | Set the widget s dependencies . |
44,193 | protected function resolveOutputType ( $ type ) { if ( $ this -> propertyInputFactory ( ) -> isResolvable ( $ type ) ) { $ this -> setInputType ( $ type ) ; return static :: PROPERTY_CONTROL ; } elseif ( $ this -> propertyDisplayFactory ( ) -> isResolvable ( $ type ) ) { $ this -> setDisplayType ( $ type ) ; return sta... | Resolve the property output type . |
44,194 | private function setCoreData ( array $ data ) { if ( isset ( $ data [ 'input_type' ] ) ) { $ this -> setInputType ( $ data [ 'input_type' ] ) ; } if ( isset ( $ data [ 'display_type' ] ) ) { $ this -> setDisplayType ( $ data [ 'display_type' ] ) ; } if ( isset ( $ data [ 'property_type' ] ) ) { $ this -> setPropertyTyp... | Set the core data for the widget and property s first . |
44,195 | private function resolveInputType ( ) { $ type = null ; $ metadata = $ this -> propertyData ( ) ; if ( $ metadata ) { if ( isset ( $ metadata [ 'hidden' ] ) && $ metadata [ 'hidden' ] ) { $ type = static :: HIDDEN_FORM_CONTROL ; } if ( ! $ type && isset ( $ metadata [ 'input_type' ] ) ) { $ type = $ metadata [ 'input_t... | Resolve the property control type . |
44,196 | private function resolveDisplayType ( ) { $ type = null ; $ metadata = $ this -> propertyData ( ) ; if ( $ metadata ) { if ( isset ( $ metadata [ 'display_type' ] ) ) { $ type = $ metadata [ 'display_type' ] ; } } if ( $ this -> propertyType || $ this -> property ) { $ type = $ this -> property ( ) -> displayType ( ) ;... | Resolve the property display type . |
44,197 | private function createProperty ( ) { $ propType = $ this -> propertyType ( ) ; if ( empty ( $ propType ) ) { $ ident = $ this -> propertyIdent ( ) ; if ( $ ident && is_string ( $ ident ) ) { $ message = sprintf ( 'Missing property type for property "%s"' , $ ident ) ; } else { $ message = sprintf ( 'Missing property t... | Create the widget s model property from the property s dataset . |
44,198 | private function createInputProperty ( ) { $ prop = $ this -> property ( ) ; $ type = $ this -> inputType ( ) ; $ input = $ this -> propertyInputFactory ( ) -> create ( $ type ) ; if ( $ this -> formGroup ( ) && ( $ input instanceof FormInputInterface ) ) { $ input -> setFormGroup ( $ this -> formGroup ( ) ) ; } if ( $... | Create the widget s form control property . |
44,199 | private function createDisplayProperty ( ) { $ prop = $ this -> property ( ) ; $ type = $ this -> displayType ( ) ; $ display = $ this -> propertyDisplayFactory ( ) -> create ( $ type ) ; if ( $ this -> formGroup ( ) && ( $ display instanceof FormInputInterface ) ) { $ display -> setFormGroup ( $ this -> formGroup ( ) ... | Create the widget s display property . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.