idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
42,300
private function setDefaultValue ( ModelInterface $ model , PropertyValueBagInterface $ propertyValueBag , $ propertyName , EnvironmentInterface $ environment ) { $ propertiesDefinition = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) ; if ( $ modelValue = $ model -> getProperty ( $ propertyName ...
Set the default value if no value is set .
42,301
private function getChildProvidersOf ( $ parentProvider , $ relationships = null ) { if ( null === $ relationships ) { $ relationships = $ this -> getEnvironment ( ) -> getDataDefinition ( ) -> getModelRelationshipDefinition ( ) ; } $ mySubTables = [ ] ; foreach ( $ relationships -> getChildConditions ( $ parentProvide...
Retrieve the child data provider names for the passed parent provider .
42,302
private function addParentFilter ( ConfigInterface $ config , ModelInterface $ parentModel ) { $ environment = $ this -> getEnvironment ( ) ; $ definition = $ environment -> getDataDefinition ( ) ; $ basicDefinition = $ definition -> getBasicDefinition ( ) ; if ( ! $ basicDefinition -> getParentDataProvider ( ) ) { ret...
Add the parent filtering to the given data config if any defined .
42,303
private function calculateRootConfig ( ) { $ rootConfig = $ this -> getEnvironment ( ) -> getBaseConfigRegistry ( ) -> getBaseConfig ( ) -> setSorting ( $ this -> getSorting ( ) ) ; $ this -> getPanel ( ) -> initialize ( $ rootConfig ) ; return $ rootConfig ; }
Put the base filter and sorting into a config .
42,304
public function getChildrenOf ( $ providerName , $ level = 0 , $ parentModel = null ) { $ environment = $ this -> getEnvironment ( ) ; $ dataProvider = $ environment -> getDataProvider ( $ providerName ) ; $ rootConfig = $ this -> calculateRootConfig ( ) ; if ( $ rootCondition = $ environment -> getDataDefinition ( ) -...
Collect all items from real root - without root id .
42,305
public function handleEvent ( ActionEvent $ event ) { $ this -> event = $ event ; $ this -> process ( ) ; $ this -> event = null ; }
Method to buffer the event and then process it .
42,306
protected function isEditOnlyResponse ( ) { if ( $ this -> getEnvironment ( ) -> getDataDefinition ( ) -> getBasicDefinition ( ) -> isEditOnlyMode ( ) ) { $ this -> callAction ( 'edit' ) ; return true ; } return false ; }
Get response from edit action if we are in edit only mode .
42,307
protected function getModel ( EnvironmentInterface $ environment ) { $ modelId = ModelId :: fromSerialized ( $ environment -> getInputProvider ( ) -> getParameter ( 'id' ) ) ; $ dataProvider = $ environment -> getDataProvider ( $ modelId -> getDataProviderName ( ) ) ; $ model = $ dataProvider -> fetch ( $ dataProvider ...
Retrieve the model from the database or redirect to error page if model could not be found .
42,308
protected function getPropertyLabel ( EnvironmentInterface $ environment , PropertyInterface $ property ) { $ translator = $ environment -> getTranslator ( ) ; $ label = $ translator -> translate ( $ property -> getLabel ( ) , $ environment -> getDataDefinition ( ) -> getName ( ) ) ; if ( ! $ label ) { $ label = $ tran...
Calculate the label of a property to se in show view .
42,309
protected function convertModel ( $ model , $ environment ) { $ definition = $ environment -> getDataDefinition ( ) ; $ properties = $ definition -> getPropertiesDefinition ( ) ; $ palette = $ definition -> getPalettesDefinition ( ) -> findPalette ( $ model ) ; $ values = [ ] ; $ labels = [ ] ; foreach ( $ palette -> g...
Convert a model to it s labels and human readable values .
42,310
protected function getHeadline ( TranslatorInterface $ translator , $ model ) { $ headline = $ translator -> translate ( 'MSC.showRecord' , $ model -> getProviderName ( ) , [ 'ID ' . $ model -> getId ( ) ] ) ; if ( 'MSC.showRecord' !== $ headline ) { return $ headline ; } return $ translator -> translate ( 'MSC.showRec...
Get the headline for the template .
42,311
protected function process ( Action $ action , EnvironmentInterface $ environment ) { if ( $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) -> isEditOnlyMode ( ) ) { return $ environment -> getView ( ) -> edit ( $ action ) ; } $ modelId = ModelId :: fromSerialized ( $ environment -> getInputProvider ( )...
Handle the show event .
42,312
public function get ( $ informationName ) { if ( isset ( $ this -> arrData [ $ informationName ] ) ) { return $ this -> arrData [ $ informationName ] ; } return null ; }
Get the additional information .
42,313
protected function guardIsCreatable ( EnvironmentInterface $ environment , ModelIdInterface $ modelId , $ redirect = false ) { $ dataDefinition = $ environment -> getDataDefinition ( ) ; if ( $ dataDefinition -> getBasicDefinition ( ) -> isCreatable ( ) ) { return ; } if ( $ redirect ) { $ eventDispatcher = $ environme...
Check if is it allowed to create a new record . This is necessary to create the copy .
42,314
public function copy ( EnvironmentInterface $ environment , ModelIdInterface $ modelId ) { $ this -> guardNotEditOnly ( $ environment -> getDataDefinition ( ) , $ modelId ) ; $ this -> guardIsCreatable ( $ environment , $ modelId ) ; $ dataProvider = $ environment -> getDataProvider ( ) ; $ model = $ dataProvider -> fe...
Copy a model by using .
42,315
protected function redirect ( $ environment , $ copiedModelId ) { $ urlBuilder = new UrlBuilder ( ) ; $ urlBuilder -> setPath ( 'contao' ) -> setQueryParameter ( 'do' , $ environment -> getInputProvider ( ) -> getParameter ( 'do' ) ) -> setQueryParameter ( 'table' , $ copiedModelId -> getDataProviderName ( ) ) -> setQu...
Redirect to edit mask .
42,316
protected function getFromDca ( $ path ) { $ chunks = \ explode ( '/' , \ trim ( $ path , '/' ) ) ; $ dca = $ this -> dca ; while ( null !== ( $ chunk = \ array_shift ( $ chunks ) ) ) { if ( ! ( \ is_array ( $ dca ) && \ array_key_exists ( $ chunk , $ dca ) ) ) { return null ; } $ dca = $ dca [ $ chunk ] ; } return $ d...
Read the specified sub path from the dca .
42,317
protected function saveTreeNodeStates ( TreeNodeStates $ states ) { $ sessionStorage = $ this -> getEnvironment ( ) -> getSessionStorage ( ) ; $ sessionStorage -> set ( $ this -> getToggleId ( ) , $ states -> getStates ( ) ) ; }
Save a tree node states instance to the session .
42,318
private function handleNodeStateChanges ( ) { $ input = $ this -> getEnvironment ( ) -> getInputProvider ( ) ; if ( ( $ modelId = $ input -> getParameter ( 'ptg' ) ) && ( $ providerName = $ input -> getParameter ( 'provider' ) ) ) { $ states = $ this -> getTreeNodeStates ( ) ; if ( 'all' === $ modelId ) { if ( $ states...
Check the get parameters if there is any node toggling .
42,319
protected function generateTreeView ( $ collection , $ treeClass ) { $ content = [ ] ; if ( ! $ this -> isSelectModeActive ( ) ) { ( new ButtonRenderer ( $ this -> environment ) ) -> renderButtonsForCollection ( $ collection ) ; } foreach ( $ collection as $ model ) { $ toggleID = $ model -> getProviderName ( ) . '_' ....
Render the tree view and return it as string .
42,320
public static function renderPasteRootButton ( GetPasteRootButtonEvent $ event ) { if ( null !== $ event -> getHtml ( ) ) { return $ event -> getHtml ( ) ; } $ environment = $ event -> getEnvironment ( ) ; $ label = $ environment -> getTranslator ( ) -> translate ( 'pasteinto.0' , $ environment -> getDataDefinition ( )...
Render the paste button for pasting into the root of the tree .
42,321
protected function viewTree ( $ collection ) { $ definition = $ this -> getDataDefinition ( ) ; $ listing = $ this -> getViewSection ( ) -> getListingConfig ( ) ; $ basicDefinition = $ definition -> getBasicDefinition ( ) ; $ environment = $ this -> getEnvironment ( ) ; $ dispatcher = $ environment -> getEventDispatche...
Render the tree view .
42,322
protected function formActionForSelect ( ContaoBackendViewTemplate $ template ) { $ environment = $ this -> getEnvironment ( ) ; if ( ! $ template -> get ( 'select' ) || ( 'select' !== $ environment -> getInputProvider ( ) -> getParameter ( 'act' ) ) ) { return ; } $ actionUrlEvent = new AddToUrlEvent ( 'select=propert...
Add the form action url for input parameter action is select .
42,323
public function handleAjaxCall ( ) { $ input = $ this -> getEnvironment ( ) -> getInputProvider ( ) ; if ( 'DcGeneralLoadSubTree' !== $ input -> getValue ( 'action' ) ) { parent :: handleAjaxCall ( ) ; return ; } $ response = new Response ( $ this -> ajaxTreeView ( $ input -> getValue ( 'id' ) , $ input -> getValue ( '...
Handle an ajax call .
42,324
public function ajaxTreeView ( $ rootId , $ providerName , $ level ) { $ this -> toggleModel ( $ providerName , $ rootId ) ; $ collection = $ this -> loadCollection ( $ rootId , $ level , $ providerName ) ; $ treeClass = '' ; switch ( 6 ) { case 5 : $ treeClass = 'tree' ; break ; case 6 : $ treeClass = 'tree_xtnd' ; br...
Handle ajax rendering of a sub tree .
42,325
protected function getWidget ( $ fieldName , $ serializedId , $ propertyValue ) { $ environment = $ this -> getEnvironment ( ) ; $ property = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) -> getProperty ( $ fieldName ) ; $ propertyValues = new PropertyValueBag ( ) ; if ( null !== $ serializedId ...
Get the widget instance .
42,326
protected function getTreeValue ( $ type , $ value ) { if ( '' !== $ value ) { $ value = StringUtil :: trimsplit ( "\t" , $ value ) ; if ( 'file' === $ type ) { foreach ( $ value as $ k => $ v ) { $ value [ $ k ] = StringUtil :: binToUuid ( Dbafs :: addResource ( \ urldecode ( $ v ) ) -> uuid ) ; } } } return $ value ;...
Retrieve the value as serialized array .
42,327
protected function getModelFromSerializedId ( $ serializedId ) { $ modelId = ModelId :: fromSerialized ( $ serializedId ) ; $ dataProvider = $ this -> getEnvironment ( ) -> getDataProvider ( $ modelId -> getDataProviderName ( ) ) ; $ model = $ dataProvider -> fetch ( $ dataProvider -> getEmptyConfig ( ) -> setId ( $ mo...
Retrieve a model from a serialized id .
42,328
protected function reloadTree ( ) { $ input = $ this -> getEnvironment ( ) -> getInputProvider ( ) ; $ serializedId = ( $ input -> hasParameter ( 'id' ) && $ input -> getParameter ( 'id' ) ) ? $ input -> getParameter ( 'id' ) : null ; $ value = $ input -> hasValue ( 'value' ) ? $ input -> getValue ( 'value' , true ) : ...
Reload the file tree .
42,329
private function getFieldName ( ) { $ environment = $ this -> getEnvironment ( ) ; $ inputProvider = $ environment -> getInputProvider ( ) ; $ fieldName = $ inputProvider -> hasValue ( 'name' ) ? $ inputProvider -> getValue ( 'name' ) : null ; if ( null === $ fieldName ) { return $ fieldName ; } if ( ( 'select' !== $ i...
Get the field name .
42,330
protected function assembleChildrenFor ( ModelInterface $ model , $ sortingProperty = null ) { $ environment = $ this -> getEnvironment ( ) ; $ definition = $ environment -> getDataDefinition ( ) ; $ provider = $ environment -> getDataProvider ( $ model -> getProviderName ( ) ) ; $ config = $ environment -> getBaseConf...
Retrieve children of a given model .
42,331
public function getSupportedLanguages ( $ currentID ) { $ environment = $ this -> getEnvironment ( ) ; $ dataProvider = $ environment -> getDataProvider ( ) ; if ( $ dataProvider instanceof MultiLanguageDataProviderInterface ) { $ supportedLanguages = $ dataProvider -> getLanguages ( $ currentID ) ; } else { $ supporte...
Return all supported languages from the default data data provider .
42,332
private function handleClonedModelProperty ( ModelInterface $ model , PropertyInterface $ property , DataProviderInterface $ dataProvider ) { $ extra = $ property -> getExtra ( ) ; $ propName = $ property -> getName ( ) ; if ( isset ( $ extra [ 'doNotCopy' ] ) && ( true === $ extra [ 'doNotCopy' ] ) ) { $ model -> setP...
Handle a property in a cloned model .
42,333
private function getActionsFromSource ( ModelIdInterface $ source , ModelIdInterface $ parentModelId = null ) { $ basicDefinition = $ this -> getEnvironment ( ) -> getDataDefinition ( ) -> getBasicDefinition ( ) ; $ filter = new Filter ( ) ; $ filter -> andModelIsFromProvider ( $ basicDefinition -> getDataProvider ( ) ...
Fetch actions from source .
42,334
private function fetchModelsFromClipboard ( FilterInterface $ filter = null , ModelIdInterface $ parentModelId = null ) { $ environment = $ this -> getEnvironment ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; if ( ! $ filter ) { $ filter = new Filter ( ) ; } $ basicDefinition = $ dataDefinition -> g...
Fetch actions from the clipboard .
42,335
private function doActions ( array $ actions , ModelIdInterface $ after = null , ModelIdInterface $ into = null , ModelIdInterface $ parentModelId = null , array & $ items = [ ] ) { if ( $ parentModelId ) { $ parentModel = $ this -> modelCollector -> getModel ( $ parentModelId ) ; } else { $ parentModel = null ; } $ de...
Effectively do the actions .
42,336
private function applyAction ( array & $ action , array & $ deepCopyList , ModelInterface $ parentModel = null ) { $ model = $ action [ 'model' ] ; $ item = $ action [ 'item' ] ; if ( $ item -> isCreate ( ) ) { $ model = $ this -> createEmptyModelWithDefaults ( ) ; } elseif ( $ item -> isCopy ( ) || $ isDeepCopy = $ it...
Apply the action onto the model .
42,337
private function doCloneAction ( ModelInterface $ model ) { $ environment = $ this -> getEnvironment ( ) ; $ clonedModel = $ this -> createClonedModel ( $ model ) ; $ duplicateEvent = new PreDuplicateModelEvent ( $ environment , $ clonedModel , $ model ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( $ duplica...
Effectively do the clone action on the model .
42,338
private function ensureSameGrouping ( array $ actions , ModelIdInterface $ after = null ) { $ environment = $ this -> getEnvironment ( ) ; $ groupingMode = ViewHelpers :: getGroupingMode ( $ environment ) ; if ( $ groupingMode && $ after && $ after -> getId ( ) ) { $ groupingField = $ groupingMode [ 'property' ] ; $ pr...
Ensure all models have the same grouping .
42,339
private function sortAndPersistModels ( array $ actions , ModelIdInterface $ after = null , ModelIdInterface $ into = null , ModelIdInterface $ parentModelId = null , array & $ items = [ ] ) { $ models = $ this -> createModelCollectionFromActions ( $ actions , $ items ) ; $ this -> triggerPrePasteModel ( $ models ) ; $...
Apply sorting and persist all models .
42,340
private function processPasteAfter ( CollectionInterface $ models , ModelIdInterface $ after = null ) { if ( $ after && $ models -> count ( ) && $ after -> getId ( ) ) { $ manualSorting = ViewHelpers :: getManualSortingProperty ( $ this -> getEnvironment ( ) ) ; $ this -> pasteAfter ( $ this -> modelCollector -> getMod...
Process paste the collection of models after the a model .
42,341
private function processPasteInto ( CollectionInterface $ models , ModelIdInterface $ into = null ) { if ( $ into && $ models -> count ( ) && $ into -> getId ( ) ) { $ manualSorting = ViewHelpers :: getManualSortingProperty ( $ this -> getEnvironment ( ) ) ; $ this -> pasteInto ( $ this -> modelCollector -> getModel ( ...
Process paste the collection of models into the a model .
42,342
private function processPasteTopWithoutReference ( CollectionInterface $ models , ModelIdInterface $ after = null , ModelIdInterface $ into = null , ModelIdInterface $ parent = null ) { if ( $ models -> count ( ) && ( ( $ after && ( 0 === ( int ) $ after -> getId ( ) ) ) || ( $ into && ( 0 === ( int ) $ into -> getId (...
Process paste the content of the clipboard onto the top after a model without reference .
42,343
private function processPasteTopAfterModel ( CollectionInterface $ models , ModelIdInterface $ parent = null ) { if ( $ parent && $ models -> count ( ) ) { $ manualSorting = ViewHelpers :: getManualSortingProperty ( $ this -> getEnvironment ( ) ) ; if ( $ manualSorting ) { $ this -> pasteTop ( $ models , $ manualSortin...
Process paste the content of the clipboard onto the top after a model .
42,344
private function createModelCollectionFromActions ( array $ actions , array & $ items ) { $ models = new DefaultCollection ( ) ; foreach ( $ actions as $ action ) { $ models -> push ( $ action [ 'model' ] ) ; $ items [ ] = $ action [ 'item' ] ; } return $ models ; }
Create the model collection from the internal models in the action collection .
42,345
private function triggerPrePasteModel ( CollectionInterface $ collection ) { foreach ( $ collection as $ model ) { $ event = new PrePasteModelEvent ( $ this -> getEnvironment ( ) , $ model ) ; $ this -> getEnvironment ( ) -> getEventDispatcher ( ) -> dispatch ( $ event :: NAME , $ event ) ; } }
Trigger for each model the pre persist event .
42,346
private function triggerPostPasteModel ( CollectionInterface $ collection ) { foreach ( $ collection as $ model ) { $ event = new PostPasteModelEvent ( $ this -> getEnvironment ( ) , $ model ) ; $ this -> getEnvironment ( ) -> getEventDispatcher ( ) -> dispatch ( $ event :: NAME , $ event ) ; } }
Trigger for each model the past persist event .
42,347
protected function doDeepCopy ( array $ deepCopyList ) { if ( empty ( $ deepCopyList ) ) { return ; } $ factory = DcGeneralFactory :: deriveFromEnvironment ( $ this -> getEnvironment ( ) ) ; $ dataDefinition = $ this -> getEnvironment ( ) -> getDataDefinition ( ) ; $ modelRelationshipDefinition = $ dataDefinition -> ge...
Do deep copy .
42,348
public function populate ( EnvironmentInterface $ environment ) { foreach ( $ environment -> getDataDefinition ( ) -> getDataProviderDefinition ( ) as $ information ) { if ( $ information instanceof ContaoDataProviderInformation ) { if ( $ environment -> hasDataProvider ( $ information -> getName ( ) ) ) { throw new Dc...
Instantiates and adds the data providers implementing ContaoDataProviderInformation to the environment .
42,349
public function prepareGlobalAllButton ( ActionEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) || ( 'showAll' !== $ event -> getAction ( ) -> getName ( ) ) ) { return ; } $ dataDefinition = $ event -> getEnvironment ( ) -> getDataDefinition ( ) ; $ backendView = $ dataDefinition -> get...
Prepare the global all button .
42,350
public function deactivateGlobalButton ( ActionEvent $ event ) { $ allowedAction = [ 'selectModelAll' , 'selectPropertyAll' , 'editAll' , 'overrideAll' ] ; if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) || ! \ in_array ( $ event -> getAction ( ) -> getName ( ) , $ allowedAction ) ) { return ; } $ dataD...
Deactivate global button their are not useful .
42,351
public function handleOriginalOptions ( GetOptionsEvent $ event ) { $ environment = $ event -> getEnvironment ( ) ; if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) || ( 'select' !== $ environment -> getInputProvider ( ) -> getParameter ( 'act' ) ) || ( 'edit' !== $ environment -> getInputProvider ( ) ->...
Handle the original widget options .
42,352
public function handleOriginalWidget ( BuildWidgetEvent $ event ) { $ environment = $ event -> getEnvironment ( ) ; if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) || ( 'select' !== $ environment -> getInputProvider ( ) -> getParameter ( 'act' ) ) || ( 'edit' !== $ environment -> getInputProvider ( ) ->...
Handle the original widget .
42,353
private function findModelIdByPropertyName ( BuildWidgetEvent $ event ) { if ( null !== $ event -> getModel ( ) -> getId ( ) ) { return ; } $ environment = $ event -> getEnvironment ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; $ inputProvider = $ environment -> getInputProvider ( ) ; $ sessionStora...
Find the model id by property name if model id not set .
42,354
private function getOriginalPropertyName ( $ propertyName , ModelIdInterface $ modelId ) { $ originalPropertyName = \ trim ( \ substr ( $ propertyName , \ strlen ( \ str_replace ( '::' , ' _' , $ modelId -> getSerialized ( ) ) . '_' ) ) , '[]' ) ; return $ originalPropertyName ? : null ; }
Get the original property name .
42,355
public function set ( $ key , $ value , $ ttl = null , $ dependency = null ) : bool { if ( $ dependency !== null ) { $ dependency -> evaluateDependency ( $ this ) ; $ value = [ $ value , $ dependency ] ; } $ key = $ this -> buildKey ( $ key ) ; return $ this -> _handler -> set ( $ key , $ value , $ ttl ) ; }
Stores a value identified by a key into cache . If the cache already contains such a key the existing value and expiration time will be replaced with the new ones respectively .
42,356
public function delete ( $ key ) : bool { $ key = $ this -> buildKey ( $ key ) ; return $ this -> _handler -> delete ( $ key ) ; }
Deletes a value with the specified key from cache .
42,357
public static function buildFieldQuery ( $ config , $ idProperty ) { if ( $ config -> getIdOnly ( ) ) { return $ idProperty ; } if ( null !== $ config -> getFields ( ) ) { $ fields = \ implode ( ', ' , $ config -> getFields ( ) ) ; if ( false !== \ stripos ( $ fields , 'DISTINCT' ) ) { return $ fields ; } return $ idPr...
Build the field list .
42,358
public static function buildWhereQuery ( $ config , array & $ parameters ) { $ query = static :: buildFilterQuery ( $ config , $ parameters ) ; if ( empty ( $ query ) ) { return '' ; } return ' WHERE ' . $ query ; }
Build the WHERE clause for a configuration .
42,359
public static function buildSortingQuery ( $ config ) { $ sorting = $ config -> getSorting ( ) ; $ result = '' ; $ fields = [ ] ; if ( empty ( $ sorting ) || ! \ is_array ( $ sorting ) ) { return '' ; } foreach ( $ sorting as $ field => $ direction ) { if ( ! empty ( $ direction ) ) { $ direction = \ strtoupper ( $ dir...
Build the order by part of a query .
42,360
public function isModelOpen ( $ providerName , $ modelId , $ ignoreAllState = false ) { if ( ! $ ignoreAllState && isset ( $ this -> states [ 'all' ] ) && ( 1 === $ this -> states [ 'all' ] ) ) { return true ; } return ( isset ( $ this -> states [ $ providerName ] [ $ modelId ] ) && $ this -> states [ $ providerName ] ...
Determine if the model is expanded .
42,361
public function handleEvent ( GetSelectModeButtonsEvent $ event ) { $ environment = $ event -> getEnvironment ( ) ; $ translator = $ environment -> getTranslator ( ) ; $ basicDefinition = $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) ; $ buttons = [ ] ; $ confirmMessage = \ htmlentities ( \ sprintf (...
Handle event for add the default buttons for the select mode .
42,362
public function update ( $ event , $ value ) { if ( null === $ value ) { return ; } $ event -> setOptions ( $ value ) ; $ event -> stopPropagation ( ) ; }
Update the options list in the event .
42,363
public function encodeValue ( $ property , $ value , PropertyValueBag $ propertyValues ) { $ environment = $ this -> getEnvironment ( ) ; $ event = new EncodePropertyValueFromWidgetEvent ( $ environment , $ this -> model , $ propertyValues ) ; $ event -> setProperty ( $ property ) -> setValue ( $ value ) ; $ environmen...
Encode a value from the widget to native data of the data provider via event .
42,364
public function loadRichTextEditor ( $ buffer , Widget $ widget ) { if ( ( null === $ widget -> rte ) || ( ( 0 !== ( \ strncmp ( $ widget -> rte , 'tiny' , 4 ) ) ) && ( 0 !== \ strncmp ( $ widget -> rte , 'ace' , 3 ) ) ) ) { return $ buffer ; } $ backendAdapter = $ this -> framework -> getAdapter ( Backend :: class ) ;...
Function for pre - loading the tiny mce .
42,365
protected function getUniqueId ( $ propertyName ) { $ inputProvider = $ this -> getEnvironment ( ) -> getInputProvider ( ) ; $ sessionStorage = $ this -> getEnvironment ( ) -> getSessionStorage ( ) ; $ selector = 'ctrl_' . $ propertyName ; if ( ( 'select' !== $ inputProvider -> getParameter ( 'act' ) ) || ( false === $...
Get the unique id .
42,366
public function getWidget ( $ property , PropertyValueBag $ inputValues = null ) { $ environment = $ this -> getEnvironment ( ) ; $ propertyDefinitions = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) ; if ( ! $ propertyDefinitions -> hasProperty ( $ property ) ) { throw new DcGeneralInvalidArgum...
Retrieve the instance of a widget for the given property .
42,367
protected function buildDatePicker ( $ objWidget ) { $ translator = $ this -> getEnvironment ( ) -> getTranslator ( ) ; $ strFormat = $ GLOBALS [ 'TL_CONFIG' ] [ $ objWidget -> rgxp . 'Format' ] ; switch ( $ objWidget -> rgxp ) { case 'datim' : $ time = ",\n timePicker:true" ; break ; case 'time' : $ time = ",\n ...
Build the date picker string .
42,368
protected function generateHelpText ( $ property ) { $ propInfo = $ this -> getEnvironment ( ) -> getDataDefinition ( ) -> getPropertiesDefinition ( ) -> getProperty ( $ property ) ; $ label = $ propInfo -> getDescription ( ) ; $ widgetType = $ propInfo -> getWidgetType ( ) ; if ( null === $ label || ( 'password' === $...
Generate the help msg for a property .
42,369
public function renderWidget ( $ property , $ ignoreErrors = false , PropertyValueBag $ inputValues = null ) { $ widget = $ this -> getWidget ( $ property , $ inputValues ) ; if ( ! $ widget ) { throw new DcGeneralRuntimeException ( 'No widget for property ' . $ property ) ; } $ this -> cleanErrors ( $ widget , $ ignor...
Render the widget for the named property .
42,370
protected function cleanErrors ( Widget $ widget , $ ignoreErrors = false ) { if ( ! $ ignoreErrors ) { return ; } $ reflectionPropError = new \ ReflectionProperty ( \ get_class ( $ widget ) , 'arrErrors' ) ; $ reflectionPropError -> setAccessible ( true ) ; $ reflectionPropError -> setValue ( $ widget , [ ] ) ; $ refl...
Clean errors for widget .
42,371
protected function widgetAddError ( $ property , Widget $ widget , PropertyValueBagInterface $ inputValues = null , $ ignoreErrors = false ) { if ( ! ( ! $ ignoreErrors && $ inputValues && $ inputValues -> hasPropertyValue ( $ property ) && $ inputValues -> isPropertyValueInvalid ( $ property ) ) ) { return ; } foreach...
Widget add error .
42,372
protected function parseCallback ( $ dispatcher , $ callbacks , $ eventName , $ arguments , $ listener ) { if ( ! ( \ is_array ( $ callbacks ) || \ is_callable ( $ callbacks ) ) ) { return ; } if ( \ is_array ( $ callbacks ) && ( 2 === \ count ( $ callbacks ) ) && ! \ is_array ( $ callbacks [ 0 ] ) ) { $ callbacks = [ ...
Register the callback handlers for the given legacy callbacks .
42,373
private function isCallbackBlacklisted ( $ callback , $ listener ) { return ( ( ContainerOnLoadCallbackListener :: class === $ listener ) && \ is_array ( $ callback ) && ( 'checkPermission' === $ callback [ 1 ] ) && ( 0 === strpos ( $ callback [ 0 ] , 'tl_' ) ) ) ; }
Check if callback is blacklisted .
42,374
protected function parseBasicMode ( BasicDefinitionInterface $ config ) { if ( null !== $ config -> getMode ( ) ) { return ; } switch ( $ this -> getFromDca ( 'list/sorting/mode' ) ) { case 0 : case 1 : case 2 : case 3 : $ config -> setMode ( BasicDefinitionInterface :: MODE_FLAT ) ; break ; case 4 : $ config -> setMod...
Parse the mode flat parented or hierarchical .
42,375
protected function parseBasicFlags ( BasicDefinitionInterface $ config ) { if ( null !== ( $ switchToEdit = $ this -> getFromDca ( 'config/switchToEdit' ) ) ) { $ config -> setSwitchToEditEnabled ( ( bool ) $ switchToEdit ) ; } if ( null !== ( $ value = $ this -> getFromDca ( 'config/forceEdit' ) ) ) { $ config -> setE...
Parse the basic flags .
42,376
protected function parseRootEntries ( ContainerInterface $ container ) { if ( \ is_array ( $ root = $ this -> getFromDca ( 'list/sorting/root' ) ) ) { $ entries = $ container -> getBasicDefinition ( ) -> getRootEntries ( ) ; $ container -> getBasicDefinition ( ) -> setRootEntries ( \ array_merge ( $ entries , $ root ) ...
This method parses the root entries definition .
42,377
protected function getRootProviderName ( ContainerInterface $ container ) { $ rootProvider = $ container -> getBasicDefinition ( ) -> getRootDataProvider ( ) ; if ( ! $ rootProvider ) { throw new DcGeneralRuntimeException ( 'Root data provider name not specified in DCA but rootEntries section specified.' ) ; } if ( ! $...
Determine the root provider name from the container .
42,378
protected function parseParentChildConditions ( ContainerInterface $ container ) { if ( $ container -> hasDefinition ( ModelRelationshipDefinitionInterface :: NAME ) ) { $ definition = $ container -> getDefinition ( ModelRelationshipDefinitionInterface :: NAME ) ; } else { $ definition = new DefaultModelRelationshipDef...
This method parses the parent - child conditions .
42,379
protected function parseListing ( ContainerInterface $ container , Contao2BackendViewDefinitionInterface $ view ) { $ listing = $ view -> getListingConfig ( ) ; $ listDca = $ this -> getFromDca ( 'list' ) ; if ( ( null === $ listing -> getRootLabel ( ) ) && ( null !== ( $ label = $ this -> getFromDca ( 'config/label' )...
Parse the listing configuration .
42,380
protected function parsePropertySortingAndGroupings ( $ view , $ parsedProperties ) { $ definitions = $ view -> getListingConfig ( ) -> getGroupAndSortingDefinition ( ) ; foreach ( ( array ) $ this -> getFromDca ( 'fields' ) as $ propName => $ propInfo ) { $ this -> parsePropertySortingAndGrouping ( $ propName , $ prop...
Parse the sorting and grouping information for all properties .
42,381
protected function parsePropertySortingAndGrouping ( $ propName , $ propInfo , $ definitions , $ parsedProperties ) { if ( empty ( $ propInfo [ 'sorting' ] ) || \ in_array ( $ propName , $ parsedProperties ) ) { return ; } $ definition = $ definitions -> add ( ) -> setName ( $ propName ) ; $ information = $ definition ...
Parse the sorting and grouping information for a given property .
42,382
protected function parsePanelFilter ( PanelRowInterface $ row ) { foreach ( $ this -> getFromDca ( 'fields' ) as $ property => $ value ) { if ( isset ( $ value [ 'filter' ] ) ) { $ element = new DefaultFilterElementInformation ( ) ; $ element -> setPropertyName ( $ property ) ; if ( ! $ row -> hasElement ( $ element ->...
Add filter elements to the panel .
42,383
protected function parsePanelSearch ( PanelRowInterface $ row ) { if ( $ row -> hasElement ( 'search' ) ) { $ element = $ row -> getElement ( 'search' ) ; } else { $ element = new DefaultSearchElementInformation ( ) ; } foreach ( $ this -> getFromDca ( 'fields' ) as $ property => $ value ) { if ( isset ( $ value [ 'sea...
Add search element to the panel .
42,384
protected function parsePanelRow ( PanelRowInterface $ row , $ elementList ) { foreach ( \ explode ( ',' , $ elementList ) as $ element ) { switch ( $ element ) { case 'filter' : $ this -> parsePanelFilter ( $ row ) ; break ; case 'sort' : $ this -> parsePanelSort ( $ row ) ; break ; case 'search' : $ this -> parsePane...
Parse a single panel row .
42,385
private function hasSubmit ( $ rows ) { foreach ( $ rows as $ row ) { foreach ( $ row as $ element ) { if ( $ element instanceof SubmitElementInformationInterface ) { return true ; } } } return false ; }
Check if the rows is somewhere a submit element .
42,386
protected function parseGlobalOperations ( Contao2BackendViewDefinitionInterface $ view ) { $ operationsDca = $ this -> getFromDca ( 'list/global_operations' ) ; $ collection = $ view -> getGlobalCommands ( ) ; $ collection -> addCommand ( new BackCommand ( ) ) ; $ collection -> addCommand ( new CreateModelCommand ( ) ...
Parse the defined container scoped operations and populate the definition .
42,387
protected function parseModelOperations ( Contao2BackendViewDefinitionInterface $ view ) { $ operationsDca = $ this -> getFromDca ( 'list/operations' ) ; if ( ! \ is_array ( $ operationsDca ) ) { return ; } $ collection = $ view -> getModelCommands ( ) ; foreach ( $ operationsDca as $ operationName => $ operationDca ) ...
Parse the defined model scoped operations and populate the definition .
42,388
private function parseOderPropertyInPalette ( ContainerInterface $ container ) { foreach ( $ container -> getPropertiesDefinition ( ) -> getProperties ( ) as $ property ) { $ extra = $ property -> getExtra ( ) ; if ( ! isset ( $ extra [ 'orderField' ] ) || ! $ container -> getPropertiesDefinition ( ) -> hasProperty ( $...
Parse if the order property is defined in the same palette as the corresponding source property . If not then define it .
42,389
protected function parseSinglePropertyLabel ( PropertyInterface $ property , $ label ) { if ( ! $ property -> getLabel ( ) ) { if ( \ is_array ( $ label ) ) { $ lang = $ label ; $ label = \ reset ( $ lang ) ; $ description = \ next ( $ lang ) ; $ property -> setDescription ( $ description ) ; } $ property -> setLabel (...
Parse the label of a single property .
42,390
protected function parseSingleProperty ( PropertyInterface $ property , array $ propInfo ) { foreach ( $ propInfo as $ key => $ value ) { switch ( $ key ) { case 'label' : $ this -> parseSinglePropertyLabel ( $ property , $ value ) ; break ; case 'description' : if ( ! $ property -> getDescription ( ) ) { $ property ->...
Parse a single property .
42,391
private function parseWidgetPageTree ( PropertyInterface $ property , array $ propInfo ) { if ( isset ( $ propInfo [ 'sourceName' ] ) || ( 'pageTree' !== $ property -> getWidgetType ( ) ) ) { return ; } if ( ! isset ( $ propInfo [ 'foreignKey' ] ) ) { $ propInfo [ 'foreignKey' ] = 'tl_page.title' ; } $ property -> setE...
Parse the property widget type of page tree .
42,392
private function parseOrderProperty ( PropertyInterface $ property , PropertyInterface $ orderProperty ) { $ orderWidgets = [ 'pageTree' => 'pageTreeOrder' , 'fileTree' => 'fileTreeOrder' , 'DcGeneralTreePicker' => 'treePickerOrder' ] ; if ( false === \ array_key_exists ( $ property -> getWidgetType ( ) , $ orderWidget...
Parse the property for order and set the order widget .
42,393
protected function parseProperties ( ContainerInterface $ container ) { if ( $ container -> hasPropertiesDefinition ( ) ) { $ definition = $ container -> getPropertiesDefinition ( ) ; } else { $ definition = new DefaultPropertiesDefinition ( ) ; $ container -> setPropertiesDefinition ( $ definition ) ; } foreach ( ( ar...
Parse the defined properties and populate the definition .
42,394
protected function createCommandInstance ( $ commandName , array & $ commandDca ) { switch ( $ commandName ) { case 'cut' : return new CutCommand ( ) ; case 'copy' : case 'deepcopy' : return new CopyCommand ( ) ; case 'all' : return new SelectCommand ( ) ; case 'toggle' : $ command = new ToggleCommand ( ) ; if ( isset ...
Create the correct command instance for the given information .
42,395
protected function createCommand ( $ commandName , array $ commandDca ) { $ command = $ this -> createCommandInstance ( $ commandName , $ commandDca ) ; $ command -> setName ( $ commandName ) ; $ parameters = $ command -> getParameters ( ) ; if ( isset ( $ commandDca [ 'href' ] ) ) { \ parse_str ( $ commandDca [ 'href'...
Create a command from dca .
42,396
protected function evalFlagSorting ( $ config , $ flag ) { if ( ( $ flag < 0 ) || ( $ flag > 12 ) ) { return ; } if ( 1 === ( $ flag % 2 ) ) { $ config -> setSortingMode ( GroupAndSortingInformationInterface :: SORT_ASC ) ; } else { $ config -> setSortingMode ( GroupAndSortingInformationInterface :: SORT_DESC ) ; } }
Evaluate the contao 2 sorting flag into sorting mode .
42,397
protected function evalFlagGrouping ( $ config , $ flag ) { if ( ( $ flag < 0 ) || ( $ flag > 12 ) ) { return ; } if ( $ flag <= 4 ) { $ config -> setGroupingMode ( GroupAndSortingInformationInterface :: GROUP_CHAR ) ; } elseif ( $ flag <= 6 ) { $ config -> setGroupingMode ( GroupAndSortingInformationInterface :: GROUP...
Evaluate the contao 2 sorting flag into grouping mode .
42,398
protected function evalFlagGroupingLength ( $ config , $ flag ) { if ( ( 1 === $ flag ) || ( 2 === $ flag ) ) { $ config -> setGroupingLength ( 1 ) ; } elseif ( ( 3 === $ flag ) || ( 4 === $ flag ) ) { $ config -> setGroupingLength ( 2 ) ; } }
Evaluate the contao 2 sorting flag into grouping length .
42,399
protected function evalFlag ( $ config , $ flag ) { $ this -> evalFlagSorting ( $ config , $ flag ) ; $ this -> evalFlagGrouping ( $ config , $ flag ) ; $ this -> evalFlagGroupingLength ( $ config , $ flag ) ; }
Evaluate the contao 2 sorting flag into sorting mode grouping mode and grouping length .