_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q245200
Item.parseValue
validation
public function parseValue($strOutputFormat = 'text', $objSettings = null) { $this->registerAssets($objSettings); $arrResult = [ 'raw' => $this->arrData, 'text' => [], 'attributes' => [], $strOutputFormat => [], 'c...
php
{ "resource": "" }
q245201
Item.parseAttribute
validation
public function parseAttribute($strAttributeName, $strOutputFormat = 'text', $objSettings = null) { return $this->internalParseAttribute($this->getAttribute($strAttributeName), $strOutputFormat, $objSettings); }
php
{ "resource": "" }
q245202
Item.variantCssClass
validation
private function variantCssClass() { if ($this->isVariant()) { return 'variant'; } if ($this->isVariantBase()) { $result = 'varbase'; if (0 !== $this->getVariants(null)->getCount()) { $result .= ' varbase-with-variants'; } ...
php
{ "resource": "" }
q245203
MetaModelDefinitionBuilder.createOrGetDefinition
validation
private function createOrGetDefinition(IMetaModelDataDefinition $container) { if ($container->hasMetaModelDefinition()) { return $container->getMetaModelDefinition(); } $container->setMetaModelDefinition($definition = new MetaModelDefinition()); return $definition; ...
php
{ "resource": "" }
q245204
TableManipulation.isReserveColumnPostFix
validation
public static function isReserveColumnPostFix($strColName) { $inputProvider = new InputProvider(); if (!$inputProvider->hasValue('colname') || strtolower($strColName) !== strtolower($inputProvider->getValue('colname')) ) { return false; } foreach (se...
php
{ "resource": "" }
q245205
SupportMetaModelsController.getJsonFile
validation
private function getJsonFile($filename) { if (!is_readable($filename)) { return []; } $contents = json_decode(file_get_contents($filename), true); return $contents ?: []; }
php
{ "resource": "" }
q245206
ViewCombinations.authenticateUser
validation
protected function authenticateUser() { if (\System::getContainer()->get('cca.dc-general.scope-matcher')->currentScopeIsUnknown()) { return false; } // Do not execute anything if we are on the login page because no User is logged in. if (strpos(Environment::get('script')...
php
{ "resource": "" }
q245207
BuildMetaModelOperationsEvent.getInputScreen
validation
public function getInputScreen() { return new InputScreen( \System::getContainer()->get('cca.legacy_dic')->getService('metamodels-service-container'), $this->inputScreen['meta'], $this->inputScreen['properties'], $this->inputScreen['conditions'], $...
php
{ "resource": "" }
q245208
BaseListener.getMetaModelByModelPid
validation
protected function getMetaModelByModelPid(ModelInterface $model) { $metaModel = $this ->factory ->getMetaModel( $this->factory->translateIdToMetaModelName($model->getProperty('pid')) ); if ($metaModel === null) { throw new \InvalidArgu...
php
{ "resource": "" }
q245209
BaseListener.createAttributeInstance
validation
protected function createAttributeInstance(ModelInterface $model = null) { if (null === $model) { return null; } return $this->attributeFactory->createAttribute( $model->getPropertiesAsArray(), $this->getMetaModelByModelPid($model) ); }
php
{ "resource": "" }
q245210
AttributeDeletedListener.deleteConditionSettings
validation
protected function deleteConditionSettings(PreDeleteModelEvent $event) { $environment = $event->getEnvironment(); $model = $event->getModel(); $dataProvider = $environment->getDataProvider('tl_metamodel_dcasetting_condition'); $conditions = $dataProvider->fetchAll( ...
php
{ "resource": "" }
q245211
AbstractAttributeConditionFactory.attributeIdToName
validation
protected function attributeIdToName(IMetaModel $metaModel, $attributeId) { if (null === $attribute = $metaModel->getAttributeById($attributeId)) { throw new \RuntimeException(sprintf( 'Could not retrieve attribute %s from MetaModel %s.', $attributeId, ...
php
{ "resource": "" }
q245212
AttributeIdListener.getAttributeOptions
validation
public function getAttributeOptions(GetPropertyOptionsEvent $event) { if (!$this->wantToHandle($event)) { return; } $result = []; $metaModel = $this->getMetaModel($event->getEnvironment()); $conditionType = $event->getModel()->getProperty('type'); ...
php
{ "resource": "" }
q245213
AttributeIdListener.decodeAttributeValue
validation
public function decodeAttributeValue(DecodePropertyValueForWidgetEvent $event) { if (!$this->wantToHandle($event)) { return; } $metaModel = $this->getMetaModel($event->getEnvironment()); $value = $event->getValue(); if (!($metaModel && $value)) { ...
php
{ "resource": "" }
q245214
AttributeIdListener.encodeAttributeValue
validation
public function encodeAttributeValue(EncodePropertyValueFromWidgetEvent $event) { if (!$this->wantToHandle($event)) { return; } $metaModel = $this->getMetaModel($event->getEnvironment()); $value = $event->getValue(); if (!($metaModel && $value)) { ...
php
{ "resource": "" }
q245215
DataProviderBuilder.build
validation
protected function build(IMetaModelDataDefinition $container) { $inputScreen = $this->viewCombination->getScreen($container->getName()); if (!$inputScreen) { return; } $meta = $inputScreen['meta']; $config = $this->getDataProviderDefinition($container); ...
php
{ "resource": "" }
q245216
DataProviderBuilder.getDataProviderDefinition
validation
private function getDataProviderDefinition(IMetaModelDataDefinition $container) { // Parse data provider. if ($container->hasDataProviderDefinition()) { return $container->getDataProviderDefinition(); } $config = new DefaultDataProviderDefinition(); $container->s...
php
{ "resource": "" }
q245217
ColNameValidationListener.handle
validation
public function handle(EncodePropertyValueFromWidgetEvent $event) { if (!parent::wantToHandle($event) || ($event->getProperty() !== 'colname')) { return; } $oldColumnName = $event->getModel()->getProperty($event->getProperty()); $columnName = $event->getValue(); ...
php
{ "resource": "" }
q245218
CommandBuilder.addEditMultipleCommand
validation
private function addEditMultipleCommand(Contao2BackendViewDefinitionInterface $view) { $definition = $this->container->getBasicDefinition(); // No actions allowed. Don't add the select command button. if (!$definition->isEditable() && !$definition->isDeletable() && !$definition->isCreatable(...
php
{ "resource": "" }
q245219
CommandBuilder.parseModelOperations
validation
private function parseModelOperations(Contao2BackendViewDefinitionInterface $view) { $collection = $view->getModelCommands(); $scrOffsetAttributes = ['attributes' => 'onclick="Backend.getScrollOffset();"']; $this->createCommand($collection, 'edit', ['act' => 'edit'], 'edit.svg'); $t...
php
{ "resource": "" }
q245220
CommandBuilder.createCommand
validation
private function createCommand( CommandCollectionInterface $collection, $operationName, $queryParameters, $icon, $extraValues = [] ) { $command = $this->getCommandInstance($collection, $operationName); $parameters = $command->getParameters(); foreac...
php
{ "resource": "" }
q245221
CommandBuilder.getCommandInstance
validation
private function getCommandInstance(CommandCollectionInterface $collection, $operationName) { if ($collection->hasCommandNamed($operationName)) { $command = $collection->getCommandNamed($operationName); } else { switch ($operationName) { case 'cut': ...
php
{ "resource": "" }
q245222
CommandBuilder.getChildModelCaption
validation
private function getChildModelCaption($metaModel, $screen) { $caption = [ '', sprintf( $GLOBALS['TL_LANG']['MSC']['metamodel_edit_as_child']['label'], $metaModel->getName() ) ]; foreach ($screen['label'] as $langCode => $la...
php
{ "resource": "" }
q245223
RegisterBackendNavigation.extractUserRights
validation
private function extractUserRights(TokenInterface $token) { $beUser = $token->getUser(); if (!($beUser instanceof BackendUser)) { return []; } $allowedModules = $beUser->modules; switch (true) { case \is_string($allowedModules): $allow...
php
{ "resource": "" }
q245224
RegisterBackendNavigation.buildBackendMenuSection
validation
private function buildBackendMenuSection($groupName, Request $request) { $strRefererId = $request->attributes->get('_contao_referer_id'); $label = $this->translator->trans('MOD.' . $groupName, [], 'contao_modules'); if (\is_array($label)) { $label = $label[0]; } ...
php
{ "resource": "" }
q245225
RegisterBackendNavigation.addMenu
validation
private function addMenu(&$modules, $section, $name, $module, Request $request) { if (!isset($modules[$section])) { $modules[$section] = $this->buildBackendMenuSection($section, $request); } $active = $this->isActive($module['route'], $module['param'], $request); $class ...
php
{ "resource": "" }
q245226
RegisterBackendNavigation.isActive
validation
private function isActive($route, $params, Request $request) { if ('/contao' === $request->getPathInfo() || !($request->attributes->get('_route') === $route) ) { return false; } $attributes = $request->attributes->get('_route_params'); $query = $...
php
{ "resource": "" }
q245227
ViewCombination.getCombinations
validation
public function getCombinations() { $user = $this->getUser(); switch (true) { case ($user instanceof BackendUser): $mode = 'be'; // Try to get the group(s) // there might be a NULL in there as BE admins have no groups and /...
php
{ "resource": "" }
q245228
ViewCombination.getCombination
validation
public function getCombination($tableName) { $combinations = $this->getCombinations(); if (isset($combinations['byName'][$tableName])) { return $combinations['byName'][$tableName]; } return null; }
php
{ "resource": "" }
q245229
ViewCombination.getChildrenOf
validation
public function getChildrenOf($parentTable) { $inputScreens = array_filter($this->getInputScreens(), function ($inputScreen) use ($parentTable) { return ($inputScreen['meta']['rendertype'] === 'ctable') && ($inputScreen['meta']['ptable'] === $parentTable); }); ...
php
{ "resource": "" }
q245230
ViewCombination.getScreen
validation
public function getScreen($tableName) { $inputScreens = $this->getInputScreens(); if (isset($inputScreens[$tableName])) { return $inputScreens[$tableName]; } return null; }
php
{ "resource": "" }
q245231
ViewCombination.getInputScreens
validation
private function getInputScreens() { $combinations = $this->getCombinations(); if (null === $combinations) { return []; } $screenIds = array_map(function ($combination) { return $combination['dca_id']; }, $combinations['byName']); if ($this->...
php
{ "resource": "" }
q245232
PasteButtonListener.acceptsAnotherChild
validation
public function acceptsAnotherChild(ModelInterface $model, ModelCollector $collector) { $conditionType = $model->getProperty('type'); if (!$this->conditionFactory->supportsNesting($conditionType)) { return false; } if (-1 === ($max = $this->conditionFactory->maxChildren($...
php
{ "resource": "" }
q245233
LegendTitleListener.decodeValue
validation
public function decodeValue(DecodePropertyValueForWidgetEvent $event) { if (!$this->wantToHandle($event)) { return; } $metaModel = $this->getMetaModelFromModel($event->getModel()); $values = Helper::decodeLangArray($event->getValue(), $metaModel); $event->setVa...
php
{ "resource": "" }
q245234
LegendTitleListener.encodeValue
validation
public function encodeValue(EncodePropertyValueFromWidgetEvent $event) { if (!$this->wantToHandle($event)) { return; } $metaModel = $this->getMetaModelFromModel($event->getModel()); $values = Helper::encodeLangArray($event->getValue(), $metaModel); $event->setV...
php
{ "resource": "" }
q245235
LegendTitleListener.buildWidget
validation
public function buildWidget(BuildWidgetEvent $event) { if (!$this->wantToHandle($event)) { return; } $metaModel = $this->getMetaModelFromModel($event->getModel()); Helper::prepareLanguageAwareWidget( $event->getEnvironment(), $event->getProperty(...
php
{ "resource": "" }
q245236
InsertTags.replaceTags
validation
public function replaceTags($strTag) { $arrElements = explode('::', $strTag); // Check if we have the mm tags. if ($arrElements[0] != 'mm') { return false; } try { // Call the fitting function. switch ($arrElements[1]) { /...
php
{ "resource": "" }
q245237
InsertTags.jumpTo
validation
protected function jumpTo($mixMetaModel, $mixDataId, $intIdRenderSetting, $strParam = 'url') { // Set the param to url if empty. if (empty($strParam)) { $strParam = 'url'; } // Get the MetaModel. Return if we can not find one. $objMetaModel = $this->loadMetaModel...
php
{ "resource": "" }
q245238
InsertTags.getItem
validation
protected function getItem($metaModelIdOrName, $mixDataId, $intIdRenderSetting, $strOutput = null) { // Get the MetaModel. Return if we can not find one. $objMetaModel = $this->loadMetaModel($metaModelIdOrName); if ($objMetaModel == null) { return false; } // Set...
php
{ "resource": "" }
q245239
InsertTags.getAttribute
validation
protected function getAttribute($metaModelIdOrName, $intDataId, $strAttributeName, $strOutput = 'raw') { // Get the MM. $objMM = $this->loadMetaModel($metaModelIdOrName); if (null === $objMM) { return false; } // Set output to default if not set. if (empt...
php
{ "resource": "" }
q245240
InsertTags.getCount
validation
protected function getCount($strType, $intID) { switch ($strType) { // From module, can be a MetaModel list or filter. case 'mod': $objMetaModelResult = $this->getMetaModelDataFrom('tl_module', $intID); break; // From content element, can ...
php
{ "resource": "" }
q245241
InsertTags.loadMetaModel
validation
protected function loadMetaModel($nameOrId) { if (is_numeric($nameOrId)) { // ID. $tableName = $this->getServiceContainer()->getFactory()->translateIdToMetaModelName($nameOrId); } elseif (is_string($nameOrId)) { // Name. $tableName = $nameOrId; ...
php
{ "resource": "" }
q245242
InsertTags.getMetaModelDataFrom
validation
protected function getMetaModelDataFrom($strTable, $intID) { // Check if we know the table. if (!$this->connection->getSchemaManager()->tablesExist([$strTable])) { return null; } // Get all information form table or return null if we have no data. $statement = $t...
php
{ "resource": "" }
q245243
InsertTags.getCountFor
validation
protected function getCountFor($intMetaModelId, $intFilterId) { $metaModel = $this->loadMetaModel($intMetaModelId); if ($metaModel == null) { return false; } $objFilter = $metaModel->getEmptyFilter(); if ($intFilterId) { $collection = $this->getServic...
php
{ "resource": "" }
q245244
InsertTags.isPublishedItem
validation
protected function isPublishedItem($objMetaModel, $intItemId) { // Check publish state of an item. $statement = $this->connection ->prepare('SELECT colname FROM tl_metamodel_attribute WHERE pid=? AND check_publish=1 LIMIT 0,1'); $statement->bindValue(1, $objMetaModel->get('id'))...
php
{ "resource": "" }
q245245
DatabaseBackedListener.getMetaModelNameFromId
validation
public function getMetaModelNameFromId(GetMetaModelNameFromIdEvent $event) { $metaModelId = $event->getMetaModelId(); if (array_key_exists($metaModelId, $this->instancesById)) { $event->setMetaModelName($this->instancesById[$metaModelId]->getTableName()); return; } ...
php
{ "resource": "" }
q245246
DatabaseBackedListener.createInstanceViaLegacyFactory
validation
protected function createInstanceViaLegacyFactory(CreateMetaModelEvent $event, $arrData) { $name = $arrData['tableName']; if (!isset($GLOBALS['METAMODELS']['factories'][$name])) { return false; } // @codingStandardsIgnoreStart @trigger_error('Creating MetaModel i...
php
{ "resource": "" }
q245247
DatabaseBackedListener.createInstance
validation
protected function createInstance(CreateMetaModelEvent $event, $arrData) { if (!$this->createInstanceViaLegacyFactory($event, $arrData)) { $metaModel = new MetaModel($arrData, $this->dispatcher, $this->database); $metaModel->setServiceContainer(function () { return $t...
php
{ "resource": "" }
q245248
DatabaseBackedListener.createMetaModel
validation
public function createMetaModel(CreateMetaModelEvent $event) { if ($event->getMetaModel() !== null) { return; } if (isset($this->instancesByTable[$event->getMetaModelName()])) { $event->setMetaModel($this->instancesByTable[$event->getMetaModelName()]); r...
php
{ "resource": "" }
q245249
DatabaseBackedListener.collectMetaModelTableNames
validation
public function collectMetaModelTableNames(CollectMetaModelTableNamesEvent $event) { if ($this->tableNamesCollected) { $event->addMetaModelNames($this->tableNames); return; } $tables = $this ->database ->createQueryBuilder() ->sel...
php
{ "resource": "" }
q245250
DatabaseBackedListener.collectMetaModelAttributeInformation
validation
public function collectMetaModelAttributeInformation(CollectMetaModelAttributeInformationEvent $event) { $metaModelName = $event->getMetaModel()->getTableName(); if (!array_key_exists($metaModelName, $this->attributeInformation)) { $attributes = $this ->database ...
php
{ "resource": "" }
q245251
PaginationLimitCalculator.getMaxPaginationLinks
validation
public function getMaxPaginationLinks() { if (null === $this->maxPaginationLinks) { $this->setMaxPaginationLinks(\Config::get('maxPaginationLinks')); } return $this->maxPaginationLinks; }
php
{ "resource": "" }
q245252
PaginationLimitCalculator.getPaginationString
validation
public function getPaginationString() { $this->calculate(); if ($this->getPerPage() == 0) { return ''; } // Add pagination menu. $objPagination = new \Pagination($this->calculatedTotal, $this->getPerPage(), $this->getMaxPaginationLinks()); return $objPa...
php
{ "resource": "" }
q245253
PaginationLimitCalculator.calculatePaginated
validation
private function calculatePaginated() { $this->calculatedTotal = $this->getTotalAmount(); // If a total limit has been defined, we need to honor that. if (($this->calculatedLimit !== null) && ($this->calculatedTotal > $this->calculatedLimit)) { $this->calculatedTotal -= $this->c...
php
{ "resource": "" }
q245254
PaginationLimitCalculator.calculate
validation
protected function calculate() { if (!$this->isDirty()) { return; } $this->isDirty = false; $this->calculatedOffset = null; $this->calculatedLimit = null; // If defined, we override the pagination here. if ($this->isLimited()) { if ...
php
{ "resource": "" }
q245255
SubDcaWidget.getHelpWizard
validation
protected function getHelpWizard($key, $field) { // Add the help wizard. if (empty($field['eval']['helpwizard'])) { return ''; } $event = new GenerateHtmlEvent( 'about.svg', $GLOBALS['TL_LANG']['MSC']['helpWizard'], 'style="vertical-al...
php
{ "resource": "" }
q245256
SubDcaWidget.makeMandatory
validation
protected function makeMandatory($field, $row, $key) { $field['eval']['required'] = false; // Use strlen() here (see contao core issue #3277). if (empty($field['eval']['mandatory'])) { return $field; } if (is_array($this->varValue[$row][$key])) { if (...
php
{ "resource": "" }
q245257
SubDcaWidget.getWidgetClass
validation
protected function getWidgetClass($field) { $className = $GLOBALS[(TL_MODE == 'BE' ? 'BE_FFL' : 'TL_FFL')][$field['inputType']]; if (($className !== '') && class_exists($className)) { return $className; } return null; }
php
{ "resource": "" }
q245258
SubDcaWidget.handleLoadCallback
validation
protected function handleLoadCallback($field, $value) { // Load callback. if (isset($field['load_callback']) && is_array($field['load_callback'])) { foreach ($field['load_callback'] as $callback) { $this->import($callback[0]); $value = $this->{$callback[0]...
php
{ "resource": "" }
q245259
SubDcaWidget.initializeWidget
validation
protected function initializeWidget(&$arrField, $strRow, $strKey, $varValue) { $xlabel = $this->getHelpWizard($strKey, $arrField); // Input field callback. if (isset($arrField['input_field_callback']) && is_array($arrField['input_field_callback'])) { if (!is_object($this->$arrFi...
php
{ "resource": "" }
q245260
SubDcaWidget.handleSaveCallback
validation
protected function handleSaveCallback($field, $widget, $value) { $newValue = $value; if (isset($field['save_callback']) && is_array($field['save_callback'])) { foreach ($field['save_callback'] as $callback) { $this->import($callback[0]); try { ...
php
{ "resource": "" }
q245261
SubDcaWidget.validateWidget
validation
protected function validateWidget(&$arrField, $strRow, $strKey, &$varInput) { $varValue = $varInput[$strRow][$strKey]; $objWidget = $this->initializeWidget($arrField, $strRow, $strKey, $varValue); if (!is_object($objWidget)) { return false; } // Hack for checkbo...
php
{ "resource": "" }
q245262
SubDcaWidget.validator
validation
protected function validator($varInput) { $blnHasError = false; foreach ($this->arrSubFields as $strFieldName => &$arrSubField) { if (!$this->validateWidget($arrSubField, $strFieldName, 'value', $varInput)) { $blnHasError = true; } foreach ($this-...
php
{ "resource": "" }
q245263
SubDcaWidget.getHelpForWidget
validation
protected function getHelpForWidget($widget) { if ($GLOBALS['TL_CONFIG']['showHelp'] && $widget->description) { return sprintf( '<p class="tl_help tl_tip%s">%s</p>', $widget->tl_class, $widget->description ); } return '...
php
{ "resource": "" }
q245264
SubDcaWidget.buildOptions
validation
protected function buildOptions() { $options = array(); foreach ($this->arrWidgets as $widgetRow) { $columns = array(); foreach ($widgetRow as $widget) { /** @var Widget $widget */ $valign = ($widget->valign != '' ? ' valign="' . $widget->valig...
php
{ "resource": "" }
q245265
VisibilityConditionBuildingListener.handle
validation
public function handle(BuildDataDefinitionEvent $event) { if ('tl_metamodel_dca_sortgroup' !== $event->getContainer()->getName()) { return; } foreach ($event->getContainer()->getPalettesDefinition()->getPalettes() as $palette) { foreach ($palette->getProperties() as ...
php
{ "resource": "" }
q245266
VisibilityConditionBuildingListener.addCondition
validation
private function addCondition(PropertyInterface $property, ConditionInterface $condition) { $chain = $property->getVisibleCondition(); if (!($chain && ($chain instanceof PropertyConditionChain) && $chain->getConjunction() == PropertyConditionChain::AND_CONJUNCTION ) ...
php
{ "resource": "" }
q245267
AbstractFilterSettingTypeRenderer.modelToLabel
validation
public function modelToLabel(ModelToLabelEvent $event) { if (!$this->scopeMatcher->currentScopeIsBackend()) { return; } $model = $event->getModel(); if (($model->getProviderName() !== 'tl_metamodel_filtersetting') || !in_array($event->getModel()->getProperty(...
php
{ "resource": "" }
q245268
AbstractFilterSettingTypeRenderer.getLabelComment
validation
protected function getLabelComment(ModelInterface $model, TranslatorInterface $translator) { if ($model->getProperty('comment')) { return sprintf( $translator->translate('typedesc._comment_', 'tl_metamodel_filtersetting'), StringUtil::specialchars($model->getPrope...
php
{ "resource": "" }
q245269
AbstractFilterSettingTypeRenderer.getLabelImage
validation
protected function getLabelImage(ModelInterface $model) { $typeFactory = $this->factory->getTypeFactory($model->getProperty('type')); $image = $this->iconBuilder->getBackendIconImageTag( $this->updateImageWithDisabled($model, $typeFactory->getTypeIcon()), '', '',...
php
{ "resource": "" }
q245270
AbstractFilterSettingTypeRenderer.getLabelText
validation
protected function getLabelText(TranslatorInterface $translator, ModelInterface $model) { $type = $model->getProperty('type'); $label = $translator->translate('typenames.' . $type, 'tl_metamodel_filtersetting'); if ($label == 'typenames.' . $type) { return $type; } ...
php
{ "resource": "" }
q245271
AbstractFilterSettingTypeRenderer.getLabelPattern
validation
protected function getLabelPattern(EnvironmentInterface $environment, ModelInterface $model) { $translator = $environment->getTranslator(); $type = $model->getProperty('type'); $combined = 'typedesc.' . $type; if (($resultPattern = $translator->translate($combined, 'tl_metam...
php
{ "resource": "" }
q245272
AbstractFilterSettingTypeRenderer.updateImageWithDisabled
validation
private function updateImageWithDisabled(ModelInterface $model, $image) { $this->preCreateInverseImage($model, $image); if ($model->getProperty('enabled')) { return $image; } if (false === $intPos = strrpos($image, '.')) { return $image; } re...
php
{ "resource": "" }
q245273
AbstractFilterSettingTypeRenderer.preCreateInverseImage
validation
private function preCreateInverseImage(ModelInterface $model, string $image): void { if (false === $intPos = strrpos($image, '.')) { return; } if ($model->getProperty('enabled')) { $this->iconBuilder->getBackendIcon(substr_replace($image, '_1', $intPos, 0)); ...
php
{ "resource": "" }
q245274
BreadcrumbStore.push
validation
public function push($url, $table, $icon) { $this->elements[] = [ 'url' => $url, 'text' => $this->getLabel($table), 'icon' => $this->iconBuilder->getBackendIcon($icon) ]; }
php
{ "resource": "" }
q245275
BreadcrumbStore.getLabel
validation
public function getLabel($table): string { if (strpos($table, 'tl_') !== 0) { return $table; } $shortTable = str_replace('tl_', '', $table); $label = $this->translator->trans('BRD.' . $shortTable, [], 'contao_default'); if ($label === $shortTable) { ...
php
{ "resource": "" }
q245276
TemplateList.getTemplatesForBase
validation
public function getTemplatesForBase($templateBaseName) { $allTemplates = array_replace_recursive( $this->fetchTemplatesFromThemes($templateBaseName), $this->fetchRootTemplates($templateBaseName), $this->fetchTemplatesFromResourceDirectories($templateBaseName) ); ...
php
{ "resource": "" }
q245277
TemplateList.fetchTemplatesFromResourceDirectories
validation
private function fetchTemplatesFromResourceDirectories($templateBaseName) { $allTemplates = []; $themeName = $this->getNoThemeMessage(); // Add the module templates folders if they exist. foreach ($this->resourceDirs as $resourceDir) { $allTemplates = array_replace_rec...
php
{ "resource": "" }
q245278
TemplateList.getTemplatesForBaseFrom
validation
private function getTemplatesForBaseFrom($base, $folder, $themeName) { if (!is_dir($folder)) { return []; } $themeName = trim($themeName); $foundTemplates = Finder::create()->in($folder)->name($base . '*'); $templates = []; foreach ($foundTemplates ...
php
{ "resource": "" }
q245279
ConditionOr.getMatchingIds
validation
public function getMatchingIds() { $arrIds = array(); foreach ($this->arrChildFilters as $objChildFilter) { $arrChildMatches = $objChildFilter->getMatchingIds(); // NULL => all items - for OR conditions, this can never be more than all so we are already satisfied here. ...
php
{ "resource": "" }
q245280
TagsWidget.getClassForOption
validation
protected function getClassForOption($index) { // If true we need another offset. $intSub = ($this->arrConfiguration['includeBlankOption'] ? -1 : 1); $strClass = $this->strName; if ($index == 0) { $strClass .= ' first'; } elseif ($index === (count($this->option...
php
{ "resource": "" }
q245281
TagsWidget.generateOption
validation
protected function generateOption($val, $index) { $checked = ''; if (is_array($this->varValue) && in_array($val['value'], $this->varValue)) { $checked = ' checked="checked"'; } return sprintf( '<span class="%1$s opt_%2$s">' . '<input type="checkbo...
php
{ "resource": "" }
q245282
ItemRendererListener.render
validation
public function render(ModelToLabelEvent $event) { $environment = $event->getEnvironment(); /** @var IMetaModelDataDefinition $definition */ $definition = $environment->getDataDefinition(); /** @var Contao2BackendViewDefinitionInterface $viewSection */ $viewSection = $definit...
php
{ "resource": "" }
q245283
ItemRendererListener.getReadableValue
validation
public function getReadableValue(RenderReadablePropertyValueEvent $event) { $environment = $event->getEnvironment(); /** @var IMetaModelDataDefinition $definition */ $definition = $environment->getDataDefinition(); /** @var Model $model */ $model = $event->getModel(); ...
php
{ "resource": "" }
q245284
ItemRendererListener.addAdditionalParentHeaderFields
validation
public function addAdditionalParentHeaderFields(GetParentHeaderEvent $event) { $parentModel = $event->getModel(); if (!$parentModel instanceof Model) { return; } $environment = $event->getEnvironment(); /** @var IMetaModelDataDefinition $definition */ $de...
php
{ "resource": "" }
q245285
ItemRendererListener.removeInvariantAttributes
validation
private function removeInvariantAttributes(IItem $nativeItem, ICollection $renderSetting) { $model = $nativeItem->getMetaModel(); if ($model->hasVariants() && !$nativeItem->isVariantBase()) { // Create a clone to have a separate copy of the object as we are going to manipulate it here. ...
php
{ "resource": "" }
q245286
JumpToListener.decodeValue
validation
public function decodeValue(DecodePropertyValueForWidgetEvent $event) { if (!$this->wantToHandle($event) || ($event->getProperty() !== 'jumpTo')) { return; } $propInfo = $event->getEnvironment()->getDataDefinition()->getPropertiesDefinition()->getProperty('jumpTo'); $val...
php
{ "resource": "" }
q245287
JumpToListener.encodeValue
validation
public function encodeValue(EncodePropertyValueFromWidgetEvent $event) { if (!$this->wantToHandle($event) || ($event->getProperty() !== 'jumpTo')) { return; } $value = StringUtil::deserialize($event->getValue(), true); foreach ($value as $k => $v) { $value[$...
php
{ "resource": "" }
q245288
JumpToListener.buildWidget
validation
public function buildWidget(BuildWidgetEvent $event) { if (!$this->wantToHandle($event) || ($event->getProperty()->getName() !== 'jumpTo')) { return; } $model = $event->getModel(); $metaModel = $this->factory->getMetaModel($this->factory->translateIdToMet...
php
{ "resource": "" }
q245289
JumpToListener.getFilterSettings
validation
private function getFilterSettings(ModelInterface $model) { $filters = $this->connection ->createQueryBuilder() ->select('id', 'name') ->from('tl_metamodel_filter') ->where('pid=:id') ->setParameter('id', $model->getProperty('pid')) ->e...
php
{ "resource": "" }
q245290
InputScreenInformationBuilder.fetchInputScreens
validation
public function fetchInputScreens($idList): array { $idList = array_filter($idList); $builder = $this->connection->createQueryBuilder(); $screens = $builder ->select('d.*') ->from('tl_metamodel_dca', 'd') ->leftJoin('d', 'tl_metamodel', 'm', 'm.id=d.pid')...
php
{ "resource": "" }
q245291
InputScreenInformationBuilder.prepareInputScreen
validation
private function prepareInputScreen($modelName, $screen): array { if (null === $metaModel = $this->factory->getMetaModel($modelName)) { throw new \InvalidArgumentException('Could not retrieve MetaModel ' . $modelName); } $caption = ['' => $metaModel->getName()]; $desc...
php
{ "resource": "" }
q245292
InputScreenInformationBuilder.buildConditionTree
validation
private function buildConditionTree(array $conditions): array { // Build condition tree. $conditionMap = []; $bySetting = []; foreach ($conditions as $condition) { unset($converted); // Check if already mapped, if so, we need to set the values. ...
php
{ "resource": "" }
q245293
InputScreenInformationBuilder.fetchPropertiesFor
validation
private function fetchPropertiesFor($inputScreenId, IMetaModel $metaModel): array { $builder = $this->connection->createQueryBuilder(); return array_map(function ($column) use ($inputScreenId, $metaModel) { if ('attribute' !== $column['dcatype']) { return $column; ...
php
{ "resource": "" }
q245294
InputScreenInformationBuilder.fetchConditions
validation
private function fetchConditions($inputScreenId): array { $builder = $this->connection->createQueryBuilder(); return $builder ->select('cond.*', 'setting.attr_id AS setting_attr_id') ->from('tl_metamodel_dcasetting_condition', 'cond') ->leftJoin('cond', 'tl_metam...
php
{ "resource": "" }
q245295
InputScreenInformationBuilder.fetchGroupSort
validation
private function fetchGroupSort($inputScreenId, IMetaModel $metaModel): array { $builder = $this->connection->createQueryBuilder(); return array_map(function ($information) use ($inputScreenId, $metaModel) { $information['isdefault'] = (bool) $information['isdefault']; ...
php
{ "resource": "" }
q245296
InputScreenInformationBuilder.convertLegends
validation
private function convertLegends(array $properties, IMetaModel $metaModel, array $conditions): array { $result = []; $label = []; if ($trans = $metaModel->isTranslated()) { foreach ($metaModel->getAvailableLanguages() as $availableLanguage) { $label[$availableLang...
php
{ "resource": "" }
q245297
InputScreenInformationBuilder.convertLegend
validation
private function convertLegend(array $property, bool $trans, $condition, array &$legend, array &$result) { if (!empty($legend['properties'])) { $result['legend' . (\count($result) + 1)] = $legend; } $legend = [ 'label' => $trans ? unserialize($pro...
php
{ "resource": "" }
q245298
InputScreenInformationBuilder.convertAttribute
validation
private function convertAttribute(array $property, $condition, array &$legend) { if (!isset($property['col_name'])) { return; } $legend['properties'][] = [ 'name' => $property['col_name'], 'condition' => $condition($property) ]; }
php
{ "resource": "" }
q245299
ModelToLabelListener.drawAttribute
validation
private function drawAttribute(ModelToLabelEvent $event) { $model = $event->getModel(); $metaModel = $this->getMetaModelFromModel($model); $attribute = $metaModel->getAttributeById($model->getProperty('attr_id')); if ($attribute) { $type = $attribute->get('type')...
php
{ "resource": "" }