コード例 #1
0
 public function testHasSubPalette()
 {
     $this->assertFalse($this->objProperty->hasSubPalette());
     $GLOBALS['TL_DCA']['tl_test']['subpalettes']['test'] = array();
     $this->assertFalse($this->objProperty->hasSubPalette());
     $GLOBALS['TL_DCA']['tl_test']['subpalettes']['test_2'] = array();
     $this->assertFalse($this->objProperty->hasSubPalette('2'));
     $GLOBALS['TL_DCA']['tl_test']['palettes']['__selector__'][] = 'test';
     $this->assertTrue($this->objProperty->hasSubPalette('2'));
     $this->assertTrue($this->objProperty->hasSubPalette());
 }
コード例 #2
0
 /**
  * Get activated
  *
  * @param Property $objProperty
  * @param ModelInterface $objModel
  *
  * @return Definition\SubPalette|null
  */
 public static function getActivePropertySubPalette(Property $objProperty, ModelInterface $objModel)
 {
     $objProperty->getDataContainer();
     $varValue = $objModel->getProperty($objProperty->getName());
     if ($objProperty->hasSubPalette($varValue)) {
         return $objProperty->getSubPalette($varValue);
     }
     return null;
 }