_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 => [],
'class' => '',
'actions' => []
];
// No render settings, parse "normal" and hope the best - not all attribute types must provide usable output.
if (!$objSettings) {
foreach ($this->getMetaModel()->getAttributes() as $objAttribute) {
$arrResult['attributes'][$objAttribute->getColName()] = $objAttribute->getName();
foreach ($this->internalParseAttribute($objAttribute, $strOutputFormat, null) as $strKey => $varValue) {
$arrResult[$strKey][$objAttribute->getColName()] = $varValue;
}
}
return $arrResult;
}
// Add jumpTo link
$jumpTo = $this->buildJumpToLink($objSettings);
if (true === $jumpTo['deep']) {
$arrResult['actions']['jumpTo'] = [
'href' => $jumpTo['url'],
'label' => $this->getCaptionText('details'),
'class' => 'details'
];
}
// Just here for backwards compatibility with templates. See #1087
$arrResult['jumpTo'] = $jumpTo;
// First, parse the values in the same order as they are in the render settings.
foreach ($objSettings->getSettingNames() as $strAttrName) {
$objAttribute = $this->getMetaModel()->getAttribute($strAttrName);
if ($objAttribute) {
$arrResult['attributes'][$objAttribute->getColName()] = $objAttribute->getName();
foreach ($this->internalParseAttribute(
$objAttribute,
$strOutputFormat,
$objSettings
) as $strKey => $varValue) {
$arrResult[$strKey][$objAttribute->getColName()] = $varValue;
}
}
}
// Add css classes, i.e. for the frontend editing list.
if ($this->getMetaModel()->hasVariants()) {
$arrResult['class'] = $this->variantCssClass();
}
// Trigger event to allow other extensions to manipulate the parsed data.
$event = new ParseItemEvent($objSettings, $this, $strOutputFormat, $arrResult);
$this->getEventDispatcher()->dispatch(MetaModelsEvents::PARSE_ITEM, $event);
return $event->getResult();
} | 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';
}
return $result;
}
return '';
} | 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 (self::$reservedColumnPostFix as $postFix) {
if ($postFix !== strtolower(substr($strColName, -strlen($postFix)))) {
continue;
}
return true;
}
return false;
} | 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'), 'contao/login') !== false) {
return false;
}
// Issue #66 - contao/install.php is not working anymore. Thanks to Stefan Lindecke (@lindesbs).
if (strpos(Environment::get('request'), 'install') !== false) {
return false;
}
if (strpos(Environment::get('script'), 'system/bin') !== false) {
return false;
}
// Bug fix: If the user is not authenticated, contao will redirect to contao/index.php
// But in this moment the TL_PATH is not defined, so the $this->Environment->request
// generate a url without replacing the basepath(TL_PATH) with an empty string.
$authResult = $this->getUser()->authenticate();
return ($authResult === true || $authResult === null) ? true : false;
} | 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'],
$this->inputScreen['groupSort']
);
} | 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 \InvalidArgumentException('Could not retrieve MetaModel ' . $model->getProperty('pid'));
}
return $metaModel;
} | 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(
$dataProvider->getEmptyConfig()->setFilter(
[['operation' => '=', 'property' => 'attr_id', 'value' => $model->getId()]]
)
);
if ($conditions->count() < 1) {
return;
}
$conditionsGeneral = new \DC_General($dataProvider->getEmptyModel()->getProviderName());
$conditionsEnvironment = $conditionsGeneral->getEnvironment();
$conditionsDataDefinition = $conditionsEnvironment->getDataDefinition();
$conditionsPalettesDefinition = $conditionsDataDefinition->getPalettesDefinition();
/** @var \Iterator $conditionsIterator */
$conditionsIterator = $conditions->getIterator();
while ($currentCondition = $conditionsIterator->current()) {
$conditionPalette = $conditionsPalettesDefinition->getPaletteByName(
$currentCondition->getProperty('type')
);
$conditionProperties = $conditionPalette->getVisibleProperties(
$currentCondition
);
foreach ($conditionProperties as $conditionProperty) {
if ($conditionProperty->getName() !== 'attr_id') {
continue;
}
$dataProvider->delete($currentCondition);
}
$conditionsIterator->next();
}
} | 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,
$metaModel->getTableName()
));
}
return $attribute->getColName();
} | 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');
foreach ($metaModel->getAttributes() as $attribute) {
if (!$this->conditionFactory->supportsAttribute($conditionType, $attribute->get('type'))) {
continue;
}
$typeName = $attribute->get('type');
$strSelectVal = $metaModel->getTableName() .'_' . $attribute->getColName();
$result[$strSelectVal] = $attribute->getName() . ' [' . $typeName . ']';
}
$event->setOptions($result);
} | 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)) {
return;
}
$attribute = $metaModel->getAttributeById($value);
if ($attribute) {
$event->setValue($metaModel->getTableName() .'_' . $attribute->getColName());
}
} | 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)) {
return;
}
// Cut off the 'mm_xyz_' prefix.
$value = substr($value, \strlen($metaModel->getTableName() . '_'));
$attribute = $metaModel->getAttribute($value);
if ($attribute) {
$event->setValue($attribute->get('id'));
}
} | 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);
// Check config if it already exists, if not, add it.
if (!$config->hasInformation($container->getName())) {
$providerInformation = new ContaoDataProviderInformation();
$providerInformation->setName($container->getName());
$config->addInformation($providerInformation);
} else {
$providerInformation = $config->getInformation($container->getName());
}
$basicDefinition = $container->getBasicDefinition();
if ($providerInformation instanceof ContaoDataProviderInformation) {
$providerInformation
->setTableName($container->getName())
->setClassName(Driver::class)
->setInitializationData(['source' => $container->getName()])
->setVersioningEnabled(false);
$basicDefinition->setDataProvider($container->getName());
}
// If in hierarchical mode, set the root provider.
if ($basicDefinition->getMode() == BasicDefinitionInterface::MODE_HIERARCHICAL) {
$basicDefinition->setRootDataProvider($container->getName());
}
// If not standalone, set the correct parent provider.
if ('ctable' === $meta['rendertype']) {
$parentTable = $meta['ptable'];
// Check config if it already exists, if not, add it.
if (!$config->hasInformation($parentTable)) {
$providerInformation = new ContaoDataProviderInformation();
$providerInformation->setName($parentTable);
$config->addInformation($providerInformation);
} else {
$providerInformation = $config->getInformation($parentTable);
}
if ($providerInformation instanceof ContaoDataProviderInformation) {
$providerInformation
->setTableName($parentTable)
->setInitializationData(['source' => $parentTable]);
// How can we honor other drivers? We do only check for MetaModels and legacy SQL here.
if (in_array($parentTable, $this->factory->collectNames())) {
$providerInformation->setClassName(Driver::class);
}
$basicDefinition->setParentDataProvider($parentTable);
}
}
} | php | {
"resource": ""
} |
q245216 | DataProviderBuilder.getDataProviderDefinition | validation | private function getDataProviderDefinition(IMetaModelDataDefinition $container)
{
// Parse data provider.
if ($container->hasDataProviderDefinition()) {
return $container->getDataProviderDefinition();
}
$config = new DefaultDataProviderDefinition();
$container->setDataProviderDefinition($config);
return $config;
} | 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();
$metaModel = $this->getMetaModelByModelPid($event->getModel());
if ((!$columnName) || $oldColumnName !== $columnName) {
$this->tableManipulator->checkColumnDoesNotExist($metaModel->getTableName(), $columnName);
$colNames = array_keys($metaModel->getAttributes());
if (in_array($columnName, $colNames)) {
throw new \RuntimeException(
sprintf(
$event->getEnvironment()->getTranslator()->translate('columnExists', 'ERR'),
$columnName,
$metaModel->getTableName()
)
);
}
}
} | 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()) {
return;
}
$commands = $view->getGlobalCommands();
$command = new SelectCommand();
$command
->setName('all')
->setLabel('MSC.all.0')
->setDescription('MSC.all.1');
$parameters = $command->getParameters();
$parameters['act'] = 'select';
$extra = $command->getExtra();
$extra['class'] = 'header_edit_all';
$commands->addCommand($command);
} | 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');
$this->createCommand($collection, 'copy', ['act' => ''], 'copy.svg', $scrOffsetAttributes);
$this->createCommand($collection, 'cut', ['act' => 'paste', 'mode' => 'cut'], 'cut.svg', $scrOffsetAttributes);
$this->createCommand(
$collection,
'delete',
['act' => 'delete'],
'delete.svg',
[
'attributes' => sprintf(
'onclick="if (!confirm(\'%s\')) return false; Backend.getScrollOffset();"',
$this->translator->trans('MSC.deleteConfirm', [], 'contao_default')
)
]
);
$this->createCommand($collection, 'show', ['act' => 'show'], 'show.svg');
if ($this->factory->getMetaModel($this->container->getName())->hasVariants()) {
$this->createCommand(
$collection,
'createvariant',
['act' => 'createvariant'],
'bundles/metamodelscore/images/icons/variants.png'
);
}
// Check if we have some children.
foreach ($this->viewCombination->getChildrenOf($this->container->getName()) as $tableName => $screen) {
$metaModel = $this->factory->getMetaModel($tableName);
$caption = $this->getChildModelCaption($metaModel, $screen);
$this->createCommand(
$collection,
'edit_' . $tableName,
['table' => $tableName],
$this->iconBuilder->getBackendIcon($screen['meta']['backendicon']),
[
'label' => $caption[0],
'description' => $caption[1],
'idparam' => 'pid'
]
);
}
} | php | {
"resource": ""
} |
q245220 | CommandBuilder.createCommand | validation | private function createCommand(
CommandCollectionInterface $collection,
$operationName,
$queryParameters,
$icon,
$extraValues = []
) {
$command = $this->getCommandInstance($collection, $operationName);
$parameters = $command->getParameters();
foreach ($queryParameters as $name => $value) {
if (!isset($parameters[$name])) {
$parameters[$name] = $value;
}
}
if (!$command->getLabel()) {
$command->setLabel($operationName . '.0');
if (isset($extraValues['label'])) {
$command->setLabel($extraValues['label']);
}
}
if (!$command->getDescription()) {
$command->setDescription($operationName . '.1');
if (isset($extraValues['description'])) {
$command->setDescription($extraValues['description']);
}
}
$extra = $command->getExtra();
$extra['icon'] = $icon;
foreach ($extraValues as $name => $value) {
if (!isset($extra[$name])) {
$extra[$name] = $value;
}
}
} | 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':
$command = new CutCommand();
break;
case 'copy':
$command = new CopyCommand();
break;
default:
$command = new Command();
}
$command->setName($operationName);
$collection->addCommand($command);
}
return $command;
} | 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 => $label) {
if (!empty($label) && $langCode === $GLOBALS['TL_LANGUAGE']) {
$caption = [
$screen['description'][$langCode],
$label
];
}
}
return $caption;
} | 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):
$allowedModules = unserialize($allowedModules, ['allowed_classes' => false]);
break;
case null === $allowedModules:
$allowedModules = [];
break;
default:
}
return array_flip($allowedModules);
} | 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];
}
return [
'class' => ' node-expanded',
'title' => StringUtil::specialchars($this->translator->trans('MSC.collapseNode', [], 'contao_modules')),
'label' => $label,
'href' => $this->urlGenerator->generate(
'contao_backend',
['do' => $request->get('do'), 'mtg' => $groupName, 'ref' => $strRefererId]
),
'ajaxUrl' => $this->urlGenerator->generate('contao_backend'),
// backwards compatibility with e.g. EasyThemes
'icon' => 'modPlus.gif',
'modules' => [],
];
} | 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 = 'navigation ' . $name;
if (isset($module['class'])) {
$class .= ' ' . $module['class'];
}
if ($active) {
$class .= ' active';
}
if ($request->query->has('ref')) {
$module['param']['ref'] = $request->query->get('ref');
}
$modules[$section]['modules'][$name] = [
'label' => $module['label'],
'title' => $module['title'],
'class' => $class,
'isActive' => $active,
'href' => $this->urlGenerator->generate($module['route'], $module['param']),
];
} | 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 = $request->query;
foreach ($params as $param => $value) {
if (isset($attributes[$param]) && ($value !== $request->attributes['_route_params'][$param])) {
return false;
}
if ($query->has($param) && ($value !== $query->get($param))) {
return false;
}
}
return true;
} | 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
// user might have one but it is not mandatory.
// I would prefer a default group for both, fe and be groups.
$groups = $user->groups;
// Special case in combinations, admins have the implicit group id -1.
if ($user->admin) {
$groups[] = -1;
}
break;
case ($user instanceof FrontendUser):
$mode = 'fe';
$groups = $user->groups;
// Special case in combinations, anonymous frontend users have the implicit group id -1.
if (!$this->getUser()->id) {
$groups = [-1];
}
break;
default:
// Default handled as frontend anonymous.
$mode = 'fe';
$groups = [-1];
}
$groups = array_filter($groups);
if ($this->cache->contains($cacheKey = 'combinations_' . $mode . '_' . implode(',', $groups))) {
return $this->cache->fetch($cacheKey);
}
$combinations = $this->builder->getCombinationsForUser($groups, $mode);
$this->cache->save($cacheKey, $combinations);
return $combinations;
} | 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);
});
return $inputScreens;
} | 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->cache->contains($cacheKey = 'screens_' . implode(',', $screenIds))) {
return $this->cache->fetch($cacheKey);
}
$screens = $this->inputScreens->fetchInputScreens($screenIds);
$this->cache->save($cacheKey, $screens);
return $screens;
} | 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($conditionType))) {
return true;
}
return \count($collector->collectDirectChildrenOf($model)) < $max;
} | 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->setValue(unserialize($values));
} | 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->setValue($values);
} | 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(),
$metaModel,
$event->getEnvironment()->getTranslator()->translate('name_langcode', 'tl_metamodel_dcasetting'),
$event->getEnvironment()->getTranslator()->translate('name_value', 'tl_metamodel_dcasetting'),
false,
StringUtil::deserialize($event->getModel()->getProperty('legendtitle'), true)
);
} | 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]) {
// Count for mod or ce elements.
case 'total':
return $this->getCount($arrElements[2], $arrElements[3]);
// Get value from an attribute.
case 'attribute':
return $this->getAttribute($arrElements[2], $arrElements[3], $arrElements[4], $arrElements[5]);
// Get item.
case 'item':
return $this->getItem($arrElements[2], $arrElements[3], $arrElements[4], $arrElements[5]);
case 'jumpTo':
return $this->jumpTo($arrElements[2], $arrElements[3], $arrElements[4], $arrElements[5]);
default:
}
} catch (\Exception $exc) {
System::log('Error by replace tags: ' . $exc->getMessage(), __CLASS__ . ' | ' . __FUNCTION__, TL_ERROR);
}
return false;
} | 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($mixMetaModel);
if ($objMetaModel == null) {
return false;
}
// Get the render setting.
$objRenderSettings = $this
->getServiceContainer()
->getRenderSettingFactory()
->createCollection($objMetaModel, $intIdRenderSetting);
if ($objRenderSettings == null) {
return false;
}
// Get the data row.
$objItem = $objMetaModel->findById($mixDataId);
if ($objItem == null) {
return false;
}
// Render the item and check if we have a jump to.
$arrRenderedItem = $objItem->parseValue('text', $objRenderSettings);
if (!isset($arrRenderedItem['jumpTo'])) {
return false;
}
// Check if someone want the sub params.
if (stripos($strParam, 'params.') !== false) {
$mixAttName = StringUtil::trimsplit('.', $strParam);
$mixAttName = array_pop($mixAttName);
if (isset($arrRenderedItem['jumpTo']['params'][$mixAttName])) {
return $arrRenderedItem['jumpTo']['params'][$mixAttName];
}
} elseif (isset($arrRenderedItem['jumpTo'][$strParam])) {
// Else just return the ask param.
return $arrRenderedItem['jumpTo'][$strParam];
}
// Nothing hit the output. Return false.
return false;
} | 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 output to default if not set.
if (empty($strOutput)) {
$strOutput = 'html5';
}
$objMetaModelList = new ItemList();
$objMetaModelList
->setServiceContainer($this->getServiceContainer())
->setMetaModel($objMetaModel->get('id'), $intIdRenderSetting)
->overrideOutputFormat($strOutput);
// Handle a set of ids.
$arrIds = StringUtil::trimsplit(',', $mixDataId);
// Check each id if published.
foreach ($arrIds as $intKey => $intId) {
if (!$this->isPublishedItem($objMetaModel, $intId)) {
unset($arrIds[$intKey]);
}
}
// Render an empty insert tag rather than displaying a list with an empty.
// result information. do not return false here because the insert tag itself is correct.
if (count($arrIds) < 1) {
return '';
}
$objMetaModelList->addFilterRule(new StaticIdList($arrIds));
return $objMetaModelList->render(false, $this);
} | 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 (empty($strOutput)) {
$strOutput = 'raw';
}
// Get item.
$objMetaModelItem = $objMM->findById($intDataId);
if (null === $objMetaModelItem) {
throw new \RuntimeException('MetaModel item not found: ' . $intDataId);
}
// Parse attribute.
$arrAttr = $objMetaModelItem->parseAttribute($strAttributeName);
return $arrAttr[$strOutput];
} | 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 be a MetaModel list or filter.
case 'ce':
$objMetaModelResult = $this->getMetaModelDataFrom('tl_content', $intID);
break;
// Unknown element type.
default:
return false;
}
// Check if we have data.
if ($objMetaModelResult != null) {
return $this->getCountFor($objMetaModelResult->metamodel, $objMetaModelResult->metamodel_filtering);
}
return false;
} | 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;
}
if (isset($tableName)) {
return $this->getServiceContainer()->getFactory()->getMetaModel($tableName);
}
// Unknown.
return null;
} | 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 = $this->connection
->prepare('SELECT metamodel, metamodel_filtering FROM ' . $strTable . ' WHERE id=? LIMIT 0,1');
$statement->bindValue(1, $intID);
$statement->execute();
// Check if we have some data.
if ($statement->rowCount() < 1) {
return null;
}
return $statement->fetch(\PDO::FETCH_OBJ);
} | 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->getServiceContainer()->getFilterFactory()->createCollection($intFilterId);
$values = [];
foreach ($collection->getParameters() as $key) {
$values[$key] = Input::get($key);
}
$collection->addRules($objFilter, $values);
}
return $metaModel->getCount($objFilter);
} | 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'));
$statement->execute();
if ($statement->rowCount() > 0) {
$objAttrCheckPublish = $statement->fetch(\PDO::FETCH_OBJ);
$objItem = $objMetaModel->findById($intItemId);
if (!$objItem->get($objAttrCheckPublish->colname)) {
return false;
}
}
return true;
} | 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;
}
if (isset($this->tableNames[$metaModelId])) {
$event->setMetaModelName($this->tableNames[$metaModelId]);
return;
}
if (!$this->tableNamesCollected) {
$table = $this
->database
->createQueryBuilder()
->select('*')
->from('tl_metamodel')
->where('id=:id')
->setParameter('id', $metaModelId)
->setMaxResults(1)
->execute()
->fetch(\PDO::FETCH_ASSOC);
if ($table) {
$this->tableNames[$metaModelId] = $table['tableName'];
$event->setMetaModelName($this->tableNames[$metaModelId]);
}
}
} | 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 instances via global factories is deprecated.', E_USER_DEPRECATED);
// @codingStandardsIgnoreEnd
$factoryClass = $GLOBALS['METAMODELS']['factories'][$name];
$event->setMetaModel(call_user_func_array(array($factoryClass, 'createInstance'), array($arrData)));
return $event->getMetaModel() !== null;
} | 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 $this->getServiceContainer();
}, false);
$event->setMetaModel($metaModel);
}
if ($event->getMetaModel()) {
$this->instancesByTable[$event->getMetaModelName()] = $event->getMetaModel();
$this->instancesById[$event->getMetaModel()->get('id')] = $event->getMetaModel();
}
} | 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()]);
return;
}
$table = $this
->database
->createQueryBuilder()
->select('*')
->from('tl_metamodel')
->where('tableName=:tableName')
->setParameter('tableName', $event->getMetaModelName())
->setMaxResults(1)
->execute()
->fetch(\PDO::FETCH_ASSOC);
if ($table) {
$table['system_columns'] = $this->systemColumns;
$this->createInstance($event, $table);
}
} | php | {
"resource": ""
} |
q245249 | DatabaseBackedListener.collectMetaModelTableNames | validation | public function collectMetaModelTableNames(CollectMetaModelTableNamesEvent $event)
{
if ($this->tableNamesCollected) {
$event->addMetaModelNames($this->tableNames);
return;
}
$tables = $this
->database
->createQueryBuilder()
->select('*')
->from('tl_metamodel')
->orderBy('sorting')
->execute()
->fetchAll(\PDO::FETCH_ASSOC);
foreach ($tables as $table) {
$this->tableNames[$table['id']] = $table['tableName'];
}
$event->addMetaModelNames($this->tableNames);
$this->tableNamesCollected = true;
} | 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
->createQueryBuilder()
->select('*')
->from('tl_metamodel_attribute')
->where('pid=:pid')
->setParameter('pid', $event->getMetaModel()->get('id'))
->orderBy('sorting')
->execute()
->fetchAll(\PDO::FETCH_ASSOC);
$this->attributeInformation[$metaModelName] = [];
foreach ($attributes as $attribute) {
$colName = $attribute['colname'];
$this->attributeInformation[$metaModelName][$colName] = $attribute;
}
}
foreach ($this->attributeInformation[$metaModelName] as $name => $information) {
$event->addAttributeInformation($name, $information);
}
} | 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 $objPagination->generate("\n ");
} | 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->calculatedLimit;
}
$this->calculatedTotal -= $this->calculatedOffset;
// Get the current page.
$page = $this->getCurrentPage();
if ($page > ($this->calculatedTotal / $this->getPerPage())) {
$page = (int) ceil($this->calculatedTotal / $this->getPerPage());
}
// Set limit and offset.
$pageOffset = ((max($page, 1) - 1) * $this->getPerPage());
$this->calculatedOffset += $pageOffset;
if ($this->calculatedLimit === null) {
$this->calculatedLimit = $this->getPerPage();
} else {
$this->calculatedLimit = min(($this->calculatedLimit - $this->calculatedOffset), $this->getPerPage());
}
} | 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 ($this->getLimit()) {
$this->calculatedLimit = $this->getLimit();
}
if ($this->getOffset()) {
$this->calculatedOffset = $this->getOffset();
}
}
if ($this->getPerPage() > 0) {
$this->calculatePaginated();
return;
}
if ($this->calculatedLimit === null) {
$this->calculatedLimit = 0;
}
if ($this->calculatedOffset === null) {
$this->calculatedOffset = 0;
}
} | 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-align:text-bottom;"'
);
$this->getEventDispatcher()->dispatch(ContaoEvents::IMAGE_GET_HTML, $event);
return sprintf(
' <a href="%shelp.php?table=%s&field=%s_%s" title="%s" rel="lightbox[help 610 80%]">%s</a>',
TL_PATH . 'contao/',
$this->strTable,
$this->strName,
$key,
StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['helpWizard']),
$event->getHtml()
);
} | 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 (empty($this->varValue[$row][$key])) {
$field['eval']['required'] = true;
}
} else {
if (!strlen($this->varValue[$row][$key])) {
$field['eval']['required'] = true;
}
}
return $field;
} | 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]}->{$callback[1]}($value, $this);
}
}
return $value;
} | 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->$arrField['input_field_callback'][0])) {
$this->import($arrField['input_field_callback'][0]);
}
return $this->{$arrField['input_field_callback'][0]}->$arrField['input_field_callback'][1]($this, $xlabel);
}
$strClass = $this->getWidgetClass($arrField);
if (empty($strClass)) {
return null;
}
$varValue = $this->handleLoadCallback($arrField, $varValue);
$arrField = $this->makeMandatory($arrField, $strRow, $strKey);
$arrField['name'] = $this->strName . '[' . $strRow . '][' . $strKey . ']';
$arrField['id'] = $this->strId . '_' . $strRow . '_' . $strKey;
$arrField['value'] = ($varValue !== '') ? $varValue : $arrField['default'];
$arrField['eval']['tableless'] = true;
$event = new GetAttributesFromDcaEvent(
$arrField,
$arrField['name'],
$arrField['value'],
null,
$this->strTable,
$this->objDca
);
$this->getEventDispatcher()->dispatch(ContaoEvents::WIDGET_GET_ATTRIBUTES_FROM_DCA, $event);
$objWidget = new $strClass($event->getResult());
$objWidget->strId = $arrField['id'];
$objWidget->storeValues = true;
$objWidget->xlabel = $xlabel;
return $objWidget;
} | 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 {
$newValue = $this->{$callback[0]}->{$callback[1]}($newValue, $this);
} catch (Exception $e) {
$widget->addError($e->getMessage());
$this->blnSubmitInput = false;
return $value;
}
}
}
return $newValue;
} | 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 checkboxes.
if (($arrField['inputType'] == 'checkbox') && isset($varInput[$strRow][$strKey])) {
$_POST[$objWidget->name] = $varValue;
}
$objWidget->validate();
$varValue = $objWidget->value;
// Convert date formats into timestamps (check the eval setting first -> #3063).
$rgxp = $arrField['eval']['rgxp'];
if (($rgxp == 'date' || $rgxp == 'time' || $rgxp == 'datim') && $varValue != '') {
$objDate = new Date($varValue, $GLOBALS['TL_CONFIG'][$rgxp . 'Format']);
$varValue = $objDate->tstamp;
}
$varValue = $this->handleSaveCallback($arrField, $objWidget, $varValue);
$varInput[$strRow][$strKey] = $varValue;
// Do not submit if there are errors.
if ($objWidget->hasErrors()) {
return false;
}
return true;
} | 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->arrFlagFields as $strFlag => $arrFlagField) {
if (!$this->validateWidget($arrFlagField, $strFieldName, $strFlag, $varInput)) {
$blnHasError = true;
}
}
}
unset($arrSubField);
if ($blnHasError) {
$this->blnSubmitInput = false;
$this->addError($GLOBALS['TL_LANG']['ERR']['general']);
}
return $varInput;
} | 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->valign . '"' : '');
$class = ($widget->tl_class != '' ? ' class="' . $widget->tl_class . '"' : '');
$style = ($widget->style != '' ? ' style="' . $widget->style . '"' : '');
$help = $this->getHelpForWidget($widget);
$columns[] = sprintf(
'<td %1$s%2$s%3$s>%4$s%5$s</td>',
$valign,
$class,
$style,
$widget->parse(),
$help
);
}
$options[] = implode('', $columns);
}
return $options;
} | 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 $property) {
if ($property->getName() != 'rendergrouptype') {
continue;
}
$this->addCondition(
$property,
new PropertyConditionChain(
array(
new InputScreenRenderModeIs('flat', $this->connection),
new InputScreenRenderModeIs('parented', $this->connection),
),
PropertyConditionChain::OR_CONJUNCTION
)
);
}
}
} | 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
)
) {
if ($property->getVisibleCondition()) {
$previous = array($property->getVisibleCondition());
} else {
$previous = array();
}
$chain = new PropertyConditionChain(
$previous,
PropertyConditionChain::AND_CONJUNCTION
);
$property->setVisibleCondition($chain);
}
$chain->addCondition($condition);
} | 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('type'), $this->getTypes())
) {
return;
}
$environment = $event->getEnvironment();
$event
->setLabel($this->getLabelPattern($environment, $model))
->setArgs($this->getLabelParameters($environment, $model));
} | 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->getProperty('comment'))
);
}
return '';
} | 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()),
'',
'',
$this->updateImageWithDisabled($model, 'bundles/metamodelscore/images/icons/filter_default.png')
);
/** @var AddToUrlEvent $urlEvent */
$urlEvent = $this->dispatcher->dispatch(
ContaoEvents::BACKEND_ADD_TO_URL,
new AddToUrlEvent('act=edit&id='.$model->getId())
);
return sprintf(
'<a href="%s">%s</a>',
$urlEvent->getUrl(),
$image
);
} | 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;
}
return $label;
} | 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_metamodel_filtersetting')) == $combined) {
$resultPattern = $translator->translate('typedesc._default_', 'tl_metamodel_filtersetting');
}
return $resultPattern;
} | 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;
}
return substr_replace($image, '_1', $intPos, 0);
} | 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));
return;
}
$this->iconBuilder->getBackendIcon($image);
} | 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) {
$shortTable = str_replace('tl_metamodel_', '', $table);
return ucfirst($shortTable) . ' %s';
}
return StringUtil::specialchars($label);
} | php | {
"resource": ""
} |
q245276 | TemplateList.getTemplatesForBase | validation | public function getTemplatesForBase($templateBaseName)
{
$allTemplates = array_replace_recursive(
$this->fetchTemplatesFromThemes($templateBaseName),
$this->fetchRootTemplates($templateBaseName),
$this->fetchTemplatesFromResourceDirectories($templateBaseName)
);
$templateList = array();
foreach ($allTemplates as $template => $themeList) {
$templateList[$template] = sprintf(
$GLOBALS['TL_LANG']['MSC']['template_in_theme'],
$template,
implode(', ', $themeList)
);
}
ksort($templateList);
return array_unique($templateList);
} | 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_recursive(
$allTemplates,
$this->getTemplatesForBaseFrom($templateBaseName, $resourceDir . '/templates', $themeName)
);
}
return $allTemplates;
} | 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 as $template) {
/** @var \Symfony\Component\Finder\SplFileInfo $template */
$templates[$template->getBasename('.' . $template->getExtension())] = [$themeName => $themeName];
}
return $templates;
} | 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.
if ($arrChildMatches === null) {
return null;
}
if ($arrChildMatches && $this->stopAfterMatch) {
return $arrChildMatches;
}
if ($arrChildMatches) {
$arrIds = array_merge($arrIds, $arrChildMatches);
}
}
return array_unique($arrIds);
} | 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->options) - $intSub)) {
$strClass .= ' last';
}
if (($index % 2) == 1) {
$strClass .= ' even';
} else {
$strClass .= ' odd';
}
return ((strlen($this->strClass)) ? ' ' . $this->strClass : '') . $strClass;
} | 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="checkbox" name="%8$s[]" id="opt_%3$s" class="checkbox" value="%4$s"%5$s%6$s ' .
'<label id="lbl_%3$s" for="opt_%3$s">%7$s</label></span>',
// @codingStandardsIgnoreStart - Keep the comments.
$this->getClassForOption($index), // 1
$index, // 2
$this->strName.'_'.$index, // 3
$val['value'], // 4
$checked, // 5
$this->getAttributes() . $this->strTagEnding, // 6
$val['label'], // 7
$this->strName // 8
// @codingStandardsIgnoreEnd
);
} | php | {
"resource": ""
} |
q245282 | ItemRendererListener.render | validation | public function render(ModelToLabelEvent $event)
{
$environment = $event->getEnvironment();
/** @var IMetaModelDataDefinition $definition */
$definition = $environment->getDataDefinition();
/** @var Contao2BackendViewDefinitionInterface $viewSection */
$viewSection = $definition->getDefinition(Contao2BackendViewDefinitionInterface::NAME);
$listing = $viewSection->getListingConfig();
/** @var Model $model */
$model = $event->getModel();
if (!($model instanceof Model)) {
return;
}
$nativeItem = $model->getItem();
$metaModel = $nativeItem->getMetaModel();
$renderSetting = $this->renderSettingFactory
->createCollection($metaModel, $definition->getMetaModelDefinition()->getActiveRenderSetting());
if (!$renderSetting) {
return;
}
$data = array($nativeItem->parseValue('html5', $renderSetting));
if ($listing->getShowColumns()) {
$event->setArgs($data[0]['html5']);
return;
}
$template = new Template($renderSetting->get('template'));
$renderSetting = self::removeInvariantAttributes($nativeItem, $renderSetting);
$template->setData(
array(
'settings' => $renderSetting,
'items' => new Items(array($nativeItem)),
'view' => $renderSetting,
'data' => $data
)
);
$event->setLabel('%s')->setArgs(array($template->parse('html5')));
} | 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();
if (!($model instanceof Model)) {
return;
}
$nativeItem = $model->getItem();
$metaModel = $nativeItem->getMetaModel();
$renderSetting = $this->renderSettingFactory->createCollection(
$metaModel,
$definition->getMetaModelDefinition()->getActiveRenderSetting()
);
if (!$renderSetting) {
return;
}
$result = $nativeItem->parseAttribute($event->getProperty()->getName(), 'text', $renderSetting);
if (!isset($result['text'])) {
$event->setRendered(
sprintf(
'Unexpected behaviour, attribute %s text representation was not rendered.',
$event->getProperty()->getName()
)
);
return;
}
$event->setRendered($result['text']);
} | 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 */
$definition = $environment->getDataDefinition();
$item = $parentModel->getItem();
$metaModel = $item->getMetaModel();
$renderSetting = $this->renderSettingFactory->createCollection(
$metaModel,
$definition->getMetaModelDefinition()->getActiveRenderSetting()
);
$additional = array();
foreach ($renderSetting->getSettingNames() as $name) {
$parsed = $item->parseAttribute($name, 'text', $renderSetting);
$name = $item->getAttribute($name)->getName();
$additional[$name] = $parsed['text'];
}
$additional = array_merge(
$additional,
$event->getAdditional()
);
$event->setAdditional($additional);
} | 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.
$renderSetting = clone $renderSetting;
// Loop over all attributes and remove those from rendering that are not desired.
foreach (array_keys($model->getInVariantAttributes()) as $strAttrName) {
$renderSetting->setSetting($strAttrName, null);
}
}
return $renderSetting;
} | 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');
$value = StringUtil::deserialize($event->getValue(), true);
$extra = $propInfo->getExtra();
$newValues = [];
$languages = $extra['columnFields']['langcode']['options'];
foreach (array_keys($languages) as $key) {
$newValue = '';
$filter = 0;
if ($value) {
foreach ($value as $arr) {
if (!is_array($arr)) {
break;
}
// Set the new value and exit the loop.
if (array_search($key, $arr) !== false) {
$newValue = '{{link_url::' . $arr['value'] . '}}';
$filter = $arr['filter'];
break;
}
}
}
// Build the new array.
$newValues[] = [
'langcode' => $key,
'value' => $newValue,
'filter' => $filter
];
}
$event->setValue($newValues);
} | 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[$k]['value'] = str_replace(['{{link_url::', '}}'], ['', ''], $v['value']);
}
$event->setValue(serialize($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->translateIdToMetaModelName($model->getProperty('pid')));
$extra = $event->getProperty()->getExtra();
if ($metaModel->isTranslated()) {
$arrLanguages = [];
foreach ((array) $metaModel->getAvailableLanguages() as $strLangCode) {
$arrLanguages[$strLangCode] = $this->translator
->trans('LNG.'. $strLangCode, [], 'contao_languages');
}
asort($arrLanguages);
$extra['minCount'] = count($arrLanguages);
$extra['maxCount'] = count($arrLanguages);
$extra['columnFields']['langcode']['options'] = $arrLanguages;
} else {
$extra['minCount'] = 1;
$extra['maxCount'] = 1;
$extra['columnFields']['langcode']['options'] = [
'xx' => $this->translator
->trans(
'tl_metamodel_rendersettings.jumpTo_allLanguages',
[],
'contao_tl_metamodel_rendersettings'
)
];
}
$extra['columnFields']['filter']['options'] = $this->getFilterSettings($model);
$event->getProperty()->setExtra($extra);
} | 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'))
->execute()
->fetchAll(\PDO::FETCH_ASSOC);
$result = [];
foreach ($filters as $filter) {
$result[$filter['id']] = $filter['name'];
}
return $result;
} | 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')
->where($builder->expr()->in('d.id', ':idList'))
->setParameter('idList', $idList, Connection::PARAM_STR_ARRAY)
->orderBy('m.sorting')
->execute()
->fetchAll(\PDO::FETCH_ASSOC);
$result = [];
$keys = array_flip($idList);
foreach ($screens as $screen) {
$metaModelName = $keys[$screen['id']];
$result[$metaModelName] = $this->prepareInputScreen($metaModelName, $screen);
}
return $result;
} | 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()];
$description = ['' => $metaModel->getName()];
foreach (StringUtil::deserialize($screen['backendcaption'], true) as $languageEntry) {
$langCode = $languageEntry['langcode'];
$caption[$langCode] = !empty($label = $languageEntry['label']) ? $label : $caption[''];
$description[$langCode] = !empty($title = $languageEntry['description']) ? $title : $description[''];
if ($metaModel->getFallbackLanguage() === $langCode) {
$caption[''] = $label;
$description[''] = $title;
}
}
$result = [
'meta' => $screen,
'properties' => $this->fetchPropertiesFor($screen['id'], $metaModel),
'conditions' => $this->fetchConditions($screen['id']),
'groupSort' => $this->fetchGroupSort($screen['id'], $metaModel),
'label' => $caption,
'description' => $description
];
$bySetting = $this->buildConditionTree($result['conditions']);
$result['legends'] = $this->convertLegends($result['properties'], $metaModel, $bySetting);
return $result;
} | 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.
if (array_key_exists($condition['id'], $conditionMap)) {
$converted = &$conditionMap[$condition['id']];
foreach ($condition as $key => $value) {
$converted[$key] = $value;
}
} else {
$converted = \array_slice($condition, 0);
$conditionMap[$condition['id']] = &$converted;
}
// Is on root level - add to setting now.
if (empty($condition['pid'])) {
$bySetting[$condition['settingId']][] = &$converted;
continue;
}
// Is a child, check if parent already added.
if (!isset($conditionMap[$condition['pid']])) {
$temp = ['children' => []];
$conditionMap[$condition['pid']] = &$temp;
}
// Add child to parent now.
$conditionMap[$condition['pid']]['children'][] = &$converted;
}
return $bySetting;
} | 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;
}
if (!($attribute = $metaModel->getAttributeById($column['attr_id']))) {
// @codingStandardsIgnoreStart
@trigger_error(
'Unknown attribute "' . $column['attr_id'] . '" in input screen "' . $inputScreenId . '"',
E_USER_WARNING
);
// @codingStandardsIgnoreEnd
return $column;
}
$column = array_merge(
$column,
$attribute->getFieldDefinition($column),
['col_name' => $attribute->getColName()]
);
return $column;
}, $builder
->select('*')
->from('tl_metamodel_dcasetting')
->where('pid=:pid')
->andWhere('published=:published')
->setParameter('pid', $inputScreenId)
->setParameter('published', 1)
->orderBy('sorting')
->execute()
->fetchAll(\PDO::FETCH_ASSOC));
} | 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_metamodel_dcasetting', 'setting', 'cond.settingId=setting.id')
->leftJoin('setting', 'tl_metamodel_dca', 'dca', 'setting.pid=dca.id')
->where('cond.enabled=1')
->andWhere('setting.published=1')
->andWhere('dca.id=:screenId')
->setParameter('screenId', $inputScreenId)
->orderBy('pid')
->addOrderBy('sorting')
->execute()
->fetchAll(\PDO::FETCH_ASSOC);
} | 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'];
$information['ismanualsort'] = (bool) $information['ismanualsort'];
$information['rendergrouplen'] = (int) $information['rendergrouplen'];
if ($information['ismanualsort']) {
$information['rendergrouptype'] = 'none';
}
if (!empty($information['rendersortattr'])) {
if (!($attribute = $metaModel->getAttributeById($information['rendersortattr']))) {
// @codingStandardsIgnoreStart
@trigger_error(
sprintf(
'Unknown attribute "%1$s" in group sorting "%2$s.%3$s"',
$information['rendersortattr'],
$inputScreenId,
$information['id']
),
E_USER_WARNING
);
// @codingStandardsIgnoreEnd
return $information;
}
$information['col_name'] = $attribute->getColName();
}
return $information;
}, $builder
->select('*')
->from('tl_metamodel_dca_sortgroup')
->where('pid=:screenId')
->setParameter('screenId', $inputScreenId)
->orderBy('sorting')
->execute()
->fetchAll(\PDO::FETCH_ASSOC));
} | 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[$availableLanguage] = $metaModel->getName();
}
} else {
$label[$metaModel->getActiveLanguage()] = $metaModel->getName();
}
$legend = [
'label' => $label,
'hide' => false,
'properties' => []
];
$condition = function ($property) use ($conditions) {
if (!isset($conditions[$property['id']])) {
return null;
}
return [
'type' => 'conditionand',
'children' => $conditions[$property['id']]
];
};
foreach ($properties as $property) {
switch ($property['dcatype']) {
case 'legend':
$this->convertLegend($property, $trans, $condition, $legend, $result);
break;
case 'attribute':
$this->convertAttribute($property, $condition, $legend);
break;
default:
break;
}
}
if (!empty($legend['properties'])) {
$result['legend' . (\count($result) + 1)] = $legend;
}
return $result;
} | 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($property['legendtitle'], ['allowed_classes' => false])
: ['' => $property['legendtitle']],
'hide' => (bool) $property['legendhide'],
'properties' => [],
'condition' => $condition($property)
];
} | 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');
$image = $this->iconBuilder->getBackendIconImageTag(
$this->attributeFactory->getIconForType($type),
$type,
'',
'bundles/metamodelscore/images/icons/fields.png'
);
$name = $attribute->getName();
$colName = $attribute->getColName();
$isUnique = $attribute->get('isunique');
} else {
$type = 'unknown ID: ' . $model->getProperty('attr_id');
$image = $this->iconBuilder->getBackendIconImageTag('bundles/metamodelscore/images/icons/fields.png');
$name = 'unknown attribute';
$colName = 'unknown column';
$isUnique = false;
}
$event
->setLabel('<div class="field_heading cte_type %s"><strong>%s</strong> <em>[%s]</em></div>
<div class="field_type block">
%s<strong>%s</strong><span class="mandatory">%s</span> <span class="tl_class">%s</span>
</div>')
->setArgs([
$model->getProperty('published') ? 'published' : 'unpublished',
$colName,
$type,
$image,
$name,
// unique attributes are automatically mandatory
$model->getProperty('mandatory') || $isUnique
? ' ['. $this->trans('mandatory.0') . ']'
: '',
$model->getProperty('tl_class') ? sprintf('[%s]', $model->getProperty('tl_class')) : ''
]);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.