src/Contao/Dca/Palette/LegacyPalettesParser.php
public function createSubpaletteCondition($subPaletteSelector, array $selectorFieldNames = [])
    {
        $condition = null;

        // Try to find a select value first (case 1).
        $selectorValues     = \explode('_', $subPaletteSelector);
        $selectorFieldName  = \array_shift($selectorValues);
        $selectorValueCount = \count($selectorValues);

        while ($selectorValueCount) {
            if (empty($selectorValues)) {
                break;
            }

            if (\in_array($selectorFieldName, $selectorFieldNames)) {
                $condition = new PropertyValueCondition($selectorFieldName, \implode('_', $selectorValues));
                break;
            }
            $selectorFieldName .= '_' . \array_shift($selectorValues);
        }

        // If case 1 was not successful, try implicitly case 2 must apply.
        if (!$condition) {
            $condition = new PropertyTrueCondition($subPaletteSelector);
        }

        return $condition;
    }
public function createSubpaletteCondition($subPaletteSelector, array $selectorFieldNames = [])
    {
        $condition = null;

        // Try to find a select value first (case 1).
        $selectorValues     = \explode('_', $subPaletteSelector);
        $selectorFieldName  = \array_shift($selectorValues);
        $selectorValueCount = \count($selectorValues);

        while ($selectorValueCount) {
            if (empty($selectorValues)) {
                break;
            }

            if (\in_array($selectorFieldName, $selectorFieldNames)) {
                $condition = new PropertyValueCondition($selectorFieldName, \implode('_', $selectorValues));
                break;
            }
            $selectorFieldName .= '_' . \array_shift($selectorValues);
        }

        // If case 1 was not successful, try implicitly case 2 must apply.
        if (!$condition) {
            $condition = new PropertyTrueCondition($subPaletteSelector);
        }

        return $condition;
    }
public function createSubpaletteCondition ( $ subPaletteSelector , array $ selectorFieldNames = [ ] ) { $ condition = null ; // Try to find a select value first (case 1). $ selectorValues = \ explode ( '_' , $ subPaletteSelector ) ; $ selectorFieldName = \ array_shift ( $ selectorValues ) ; $ selectorValueCount = \ count ( $ selectorValues ) ; while ( $ selectorValueCount ) { if ( empty ( $ selectorValues ) ) { break ; } if ( \ in_array ( $ selectorFieldName , $ selectorFieldNames ) ) { $ condition = new PropertyValueCondition ( $ selectorFieldName , \ implode ( '_' , $ selectorValues ) ) ; break ; } $ selectorFieldName .= '_' . \ array_shift ( $ selectorValues ) ; } // If case 1 was not successful, try implicitly case 2 must apply. if ( ! $ condition ) { $ condition = new PropertyTrueCondition ( $ subPaletteSelector ) ; } return $ condition ; }
Parse the sub palette selector and create the corresponding condition.

This method supports the following cases for the sub palette selector:

Case 1: the sub palette selector contain a combination of "property name" + '_' + value
in which we require that the "property name" is contained within $selectorFieldNames.
In this cases a select/radio sub palette is in place.

Case 2: the sub palette selector is only a "property name", the value is then implicated to be true.
In this cases a checkbox sub palette is in place.

@param string $subPaletteSelector The selector being evaluated.
@param array  $selectorFieldNames The names of the properties to be used as selectors [optional].

@return PropertyTrueCondition|PropertyValueCondition|null
Parse the sub palette selector and create the corresponding condition .