Start a new default-palette condition and chain with previous condition.

@return PaletteBuilder

@throws DcGeneralRuntimeException When no palette or property has been stored.
972889
public function chainDefaultPaletteCondition()
    {
        if (!$this->palette) {
            throw new DcGeneralRuntimeException(
                'Does not know where to create the property-value condition, please create a palette or property first'
            );
        }

        $this->createPaletteConditionChain();

        $condition = $this->defaultPaletteConditionClass->newInstance();
        $event     = new CreateDefaultPaletteConditionEvent($condition, $this);
        $this->dispatchEvent($event);
        $condition = $event->getDefaultPaletteCondition();

        $event = new CreateConditionEvent($condition, $this);
        $this->dispatchEvent($event);
        $condition = $event->getCondition();

        $this->condition->addCondition($condition);

        return $this;
    }
196297
private function initializeTempDirectory()
    {
        $this->dir = __DIR__.'/.wallpaperNotifier';

        if (!file_exists($this->dir)) {
            try {
                mkdir($this->dir);
            } catch (Exception $e) {
                throw new \RuntimeException(sprintf(
                    "Wallpaper notifier requires a directory to hold its contents\n"
                    ."'%s' directory couldn't be created",
                    $this->dir
                ));
            }
        }

        // Hack: two different images are needed to reload the desktop background
        // One holds the current wallpaper, the other one is the new background
        // If you have just one image and modify it, the OS doesn't reload it
        $this->evenBackgroundImagePath = realpath($this->dir).'/even-background.png';
        $this->oddBackgroundImagePath  = realpath($this->dir).'/odd-background.png';
    }
900221
public static function setDefault()
    {
        if(!self::$default) {
            $languages = Language::all();
            if($languages) {
                $getDefault = $languages->where('isDefault', true);

                if ($getDefault) {
                    self::$default = $getDefault->first();
                    self::$current = self::$default; //current language is the same as default one in this phase

                    App::setLocale(self::$default->slug);
                    Carbon::setLocale(self::$default->slug);
                    return;
                }
            }

            throw new \Exception("Default language could not be found. Please check if a default language is defined in Administration");
        }
        return;
    }
1296187
public function createContainer()
    {
        if (empty($this->containerName)) {
            throw new DcGeneralRuntimeException('Required container name is missing');
        }

        if (null === $this->eventDispatcher) {
            throw new DcGeneralRuntimeException('Required event dispatcher is missing');
        }

        /** @var DataDefinitionContainerInterface $definitions */
        $definitions = System::getContainer()->get('cca.dc-general.data-definition-container');

        if ($definitions->hasDefinition($this->containerName)) {
            return clone $definitions->getDefinition($this->containerName);
        }

        /** @var ContainerInterface $dataContainer */
        $dataContainer = (new \ReflectionClass($this->containerClassName))->newInstance($this->containerName);

        // Backwards compatibility.
        $this->getEventDispatcher()->dispatch(
            BuildDataDefinitionEvent::NAME,
            new BuildDataDefinitionEvent($dataContainer)
        );

        $definitions->setDefinition($this->containerName, $dataContainer);

        return clone $dataContainer;
    }
752963
public function buildPaletteAndFields ($dc)
	{
		// Build the content block elements palette and fields only when editing a content element (see #5)
		if (\Input::get('act') != 'edit' && \Input::get('act') != 'show' && !isset($_GET['target']))
		{
			return;
		}
		
		$intId = (isset($_GET['target'])) ? explode('.', \Input::get('target'))[2] : $dc->id;
		
		$objContent = \ContentModel::findByPk($intId);
	
		if ($objContent === null)
		{
			return;
		}

		// Get block element
		$objElement = \ElementsModel::findOneByAlias($objContent->type);
			
		if ($objElement === null)
		{
			return;
		}

		// Add default palette (for type selection)
		$GLOBALS['TL_DCA']['tl_content']['palettes'][$objElement->alias] = '{type_legend},type';

		// Add pattern to palette
		$colPattern = \PatternModel::findVisibleByPid($objElement->id);

		if ($colPattern === null)
		{
			return;
		}
		
		$arrData = array();

		$colData = \DataModel::findByPid($intId);
		
		if ($colData !== null)
		{
			foreach ($colData as $objData)
			{
				$arrData[$objData->pattern] = $objData;
			}							
		}
	
		foreach($colPattern as $objPattern)
		{
			// Construct dca for pattern
			$strClass = Agoat\CustomContentElementsBundle\Contao\Pattern::findClass($objPattern->type);
			$bolData = Agoat\CustomContentElementsBundle\Contao\Pattern::hasData($objPattern->type);
				
			if (!class_exists($strClass))
			{
				\System::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
			}
			else
			{
				if ($bolData && !isset($arrData[$objPattern->alias]))
				{
					$arrData[$objPattern->alias] = new \DataModel();
					$arrData[$objPattern->alias]->pid = $objContent->id;
					$arrData[$objPattern->alias]->pattern = $objPattern->alias;
			
					$arrData[$objPattern->alias]->save();
				}
				
				$objPatternClass = new $strClass($objPattern);
				$objPatternClass->pid = $objContent->id;
				$objPatternClass->pattern = $objPattern->alias;
				$objPatternClass->element = $objElement->alias;			
				$objPatternClass->data = $arrData[$objPattern->alias]; // Save data to the DCA		

				$objPatternClass->create();
			}
		}
	}
723315
protected function init()
	{
		if (isset($this->theme) === false)
		{
			throw new \RuntimeException('Theme property does not exist.');
		}

		if (empty($this->theme) === false and is_string($this->theme))
		{
			$this->theme = \Theme::instance($this->theme);
		}

		// Sets active theme
		if (empty($this->theme_active) === false and is_string($this->theme_active))
		{
			$this->theme->active($this->theme_active);
		}

		// Initialize template
		$this->template_init();

		$this->theme->set_template($this->template);

		// Makes the theme instance available in all views
		$this->template->set_global('theme', $this->theme, false);
	}
380729
public SupportProvider newDefaultInstance() {
        try {
            return clazz.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("Failed to instantiate " + clazz, e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Failed to instantiate " + clazz, e);
        }
    }
1125276
public function createPaletteCollection()
    {
        if ($this->paletteCollection) {
            $this->finishPaletteCollection();
        }

        $paletteCollection = $this->paletteCollectionClass->newInstance();

        $event = new CreatePaletteCollectionEvent($paletteCollection, $this);
        $this->dispatchEvent($event);
        $this->paletteCollection = $event->getPaletteCollection();

        return $this;
    }
713257
public function finishLegend(&$legend = null)
    {
        if (!$this->legend) {
            throw new DcGeneralRuntimeException('Legend is missing, please create a legend first');
        }

        if ($this->property) {
            $this->finishProperty();
        }

        $event = new FinishLegendEvent($this->legend, $this);
        $this->dispatchEvent($event);
        $legend = $event->getLegend();

        if ($this->palette) {
            $this->palette->addLegend($legend);
        }

        $this->legend = null;

        return $this;
    }
714254
protected function addPropertyCondition(PropertyConditionInterface $condition, $scope = self::VISIBLE)
    {
        if (!$this->property) {
            throw new DcGeneralRuntimeException('Property is missing, please create a property first');
        }

        $properties = \is_object($this->property) ? [$this->property] : $this->property;

        foreach ($properties as $property) {
            /** @var PropertyInterface $property */
            $event = new AddConditionEvent($condition, $property, $this);
            $this->dispatchEvent($event);
            $condition = $event->getCondition();

            $previousCondition = self::EDITABLE === $scope
                ? $property->getEditableCondition()
                : $property->getVisibleCondition();

            if (!$previousCondition) {
                if (self::EDITABLE === $scope) {
                    $property->setEditableCondition($condition);
                } else {
                    $property->setVisibleCondition($condition);
                }
            } elseif ($previousCondition instanceof PropertyConditionChain) {
                $previousCondition->addCondition($condition);
            } else {
                $chain = $this->propertyConditionChainClass->newInstance();
                $chain->addCondition($previousCondition);
                $chain->addCondition($condition);

                if (self::EDITABLE === $scope) {
                    $property->setEditableCondition($chain);
                } else {
                    $property->setVisibleCondition($chain);
                }
            }
        }
    }
460439
public function generate()
    {
        if (!is_dir($this->getInputDirectory())) {
            throw new \RuntimeException('The MakeDocs input directory does not exist.');
        }

        if (!$this->builders) {
            throw new \RuntimeException('No MakeDocs builders present.');
        }

        // First we change the working directory to the input, this makes rendering easier since
        // all paths are relative to source directory:
        $workingDirectory = getcwd();
        chdir($this->getInputDirectory());

        foreach ($this->builders as $builder) {
            $builder->build($this);
        }

        // Restore the working directory to its original form:
        chdir($workingDirectory);
    }
1056283
public static Initialization makeDefault() {
        Initialization initialization = new Initialization();
        initialization.setEntryPoint(EntryPoint.Default.REBASE.name());
        return initialization;
    }
949995
function preRun ()
  {
    $firstRendering = !$this->renderCount++;
    if ($this->isVisible ()) {
      if ($firstRendering) {
        $this->applyPresetsOnSelf ();
        $this->setupFirstRun ();
      }
      else $this->setupRepeatedRun ();
      $this->databind ();       // This is done on the data binding context of the component's parent.
      if ($firstRendering) {
        $this->createView ();
        $this->setupView ();
      }
      $this->afterPreRun ();   // Here, composite components may setup its view model and data binder.
    }
  }
786896
public function generatePalette()
	{
		if(\Input::get('table') != 'tl_layout' || \Input::get('act') != 'edit')
		{
			return;
		}

		$layout = $this->getCurrentLayout();

		if($layout->layoutType == 'bootstrap')
		{
			// dynamically render palette so that extensions can plug into default palette
			$GLOBALS['TL_DCA']['tl_layout']['metapalettes']['__base__'] = $this->getMetaPaletteOfPalette('tl_layout');
			$GLOBALS['TL_DCA']['tl_layout']['metapalettes']['default extends __base__']  = $GLOBALS['BOOTSTRAP']['layout']['metapalette'];

			unset($GLOBALS['TL_DCA']['tl_layout']['palettes']['default']);

			foreach($GLOBALS['BOOTSTRAP']['layout']['metasubselectpalettes'] as $field => $meta)
			{
				foreach($meta as $value => $definition)
				{
					unset($GLOBALS['TL_DCA']['tl_layout']['subpalettes'][$field . '_' . $value]);
					$GLOBALS['TL_DCA']['tl_layout']['metasubselectpalettes'][$field][$value] = $definition;
				}
			}
		}
		else
		{
			\MetaPalettes::appendFields('tl_layout', 'title', array('layoutType'));
		}
	}
864926
public function setPaletteConditionChainClassName($paletteConditionChainClassName)
    {
        $event = new SetPaletteConditionChainClassNameEvent($paletteConditionChainClassName, $this);
        $this->dispatchEvent($event);
        $paletteConditionChainClassName = $event->getPaletteConditionChainClassName();

        $this->paletteConditionChainClassName = (string) $paletteConditionChainClassName;
        $this->paletteConditionChainClass     = new \ReflectionClass($this->paletteConditionChainClassName);
        return $this;
    }
646106
public function start()
    {
        if (!$this->process->isStarted()) {
            $this->setStarted();
            $this->dispatch(RunEvent::STARTED, new RunEvent($this));
            $this->process->start(
                function ($type, $data) {
                    $this->lastType = $type;
                    foreach (explode("\n", $data) as $line) {
                        $line = rtrim($line);
                        if (mb_strlen($line) > 0) {
                            $this->last = $line;
                            if ($this->updateOnProcessOutput) {
                                $this->dispatch(RunEvent::UPDATED, new RunEvent($this));
                            }
                        }
                    }
                }
            );
            $this->completed = false;
        }

        return $this;
    }
944300
public function setTarget($target)
    {
        if ((!$target instanceof PaletteInterface) && (!$target instanceof PropertyInterface)) {
            throw new DcGeneralInvalidArgumentException();
        }

        $this->target = $target;
        return $this;
    }