Calls before including template actions.

@return void
486205
public function doActions()
    {
        if ($this->isNamed()) {
            list($slug, $name) = $this->file;

            do_action("get_template_part_{$slug}", $slug, $name);

            return;
        }

        // Use first template name, if template
        // file is an array, but is not named.
        if (is_array($this->file) && isset($this->file[0])) {
            return do_action("get_template_part_{$this->file[0]}", $this->file[0], null);
        }

        do_action("get_template_part_{$this->file}", $this->file, null);
    }
1247483
protected function BeforeGather()
    {  
        if ($this->IsTriggered() && $this->Elements()->Check(Request::MethodArray($this->Method())))
        {
            return $this->OnSuccess();
        }
        return parent::BeforeGather();
    }
537245
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->set('type', $this->type);
        $this->set('title', $this->type['name']);
    }
1054823
protected function _prepareRendering()
    {
        $this->view->addDefaultViewParam('_template', $this);

        $structure = $this->getPageStructure();
        if (empty($structure)) {
            $this->setPageStructure(self::$default_page_structure);
        }
    }
1346056
public function onBeforeInit() {
        $only_dev = LessCompilerConfig::config()->only_dev;
        
        // Only check and compile either on dev, or on all environments (if set)
        if (!$only_dev || $only_dev && Director::isDev()) {

            // Allow extensions for before less is compiled
            $this->owner->extend("onBeforeLessCompiler");

            $files = LessCompilerConfig::config()->file_mappings;
            $root_path = LessCompilerConfig::config()->root_path;
            $temp_folder = TEMP_FOLDER;
            
            if (is_array($files)) {
                $theme_dir = Controller::join_links(
                    "themes",
                    SSViewer::current_theme()
                );
                $base_theme = Controller::join_links(
                    $theme_dir,
                    SSViewer::current_theme()
                );
                
                $options = array('cache_dir' => $temp_folder);
                
                if (LessCompilerConfig::config()->compress) {
                    $options['compress'] = true;
                }
                
                // First loop through all files and deal with inputs
                foreach ($files as $input => $output) {
                    if ($input && $output) {
                        
                        // Does output and input contain a path
                        if (strpos($input, '/') === false) {
                            $input = Controller::join_links(
                                $theme_dir,
                                "less",
                                $input
                            );
                        }
                        
                        if (strpos($output, '/') === false) {
                            $output = Controller::join_links(
                                $theme_dir,
                                "css",
                                $output
                            );
                        }
                        
                        // Now append the full system path to the input
                        // and output file.
                        $input = Controller::join_links(BASE_PATH, $input);
                        $output = Controller::join_links(BASE_PATH, $output);
                        
                        // Finally try to compile our less files
                        try {
                            $css_file_name = Less_Cache::Get(
                                array( $input => $root_path),
                                $options
                            );
                            $css = file_get_contents(Controller::join_links($temp_folder,$css_file_name));
                            
                            $output_file = fopen($output, "w");
                            fwrite($output_file, $css);
                            fclose($output_file);
                        } catch (exception $e) {
                            error_log($e->getMessage());
                        }
                    }
                }
            }

            // Allow extensions for after less has compiled
            $this->owner->extend("onAfterLessCompiler");
        }
    }
906822
public function preRun(): void {
    $this->insert = $this->getConnection()->insert($this->getTable(), $this->getFields());
  }
98336
public function beforePluginCompile(): void
	{
		// Receive container builder
		$builder = $this->getContainerBuilder();

		// Register services
		$builder->addDefinition($this->extensionPrefix('core.schema.hydrator'))
			->setFactory(ArrayHydrator::class);

		$builder->getDefinition($this->extensionPrefix('core.schema'))
			->setFactory('@' . $this->extensionPrefix('core.schema.hydrator') . '::hydrate', [$this->compileSchema()]);
	}
918438
protected function beforeUpdate()
    {
        $this->dispatcher->getEventsManager()->fire(Events::BEFORE_UPDATE, $this);
        $this->beforeSave();
    }
741686
protected function compile()
	{
		$buttons = new Helper\Buttons();
		$buttons->loadFromFieldset($this->buttons);
		$buttons->buttonStyle = $this->buttonStyle;

		$this->Template->buttons = $buttons;
	}
463354
public function beforeValidate()
    {
        foreach ($this->attributes as $attribute) {
            $this->owner->$attribute = HtmlPurifier::process($this->owner->$attribute, $this->config);
        }
    }
278788
public function _beforeInit()
    {
        $this->pm = $this->add($this->pagemanager_class, $this->pagemanager_options);
        /** @type Controller_PageManager $this->pm */
        $this->pm->parseRequestedURL();
        parent::_beforeInit();
    }
502728
public function beforeRender($event)
    {
        $this->Controller->set('authUser', $this->Controller->authUser);

        // beforeRender-event
        $_event = new Event('Component.Manager.beforeRender', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        if ($this->isPrefix()) {
            $this->_runCallback("beforeRender", $event);

            // beforeRender-event with Prefix
            $this->_runEvent("beforeRender");
        }
    }
74963
public function beforeRenderIndexType()
    {
        if (!($this->_action() instanceof IndexAction)) {
            return;
        }

        $controller = $this->_controller();
        $controller->set('indexFinderScopes', $this->_getIndexFinderScopes());
        $controller->set('indexFormats', $this->_getIndexFormats());
        $controller->set('indexType', $this->_getIndexType());
        $controller->set('indexTitleField', $this->_getIndexTitleField());
        $controller->set('indexBodyField', $this->_getIndexBodyField());
        $controller->set('indexImageField', $this->_getIndexImageField());
        $controller->set('indexGalleryCssClasses', $this->_getIndexGalleryCssClasses());
    }
862542
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();

		// Register as services
		foreach ($builder->findByType(IContainerAware::class) as $service) {
			$service->addSetup('setContainer');
		}
	}
1012491
public function actionTemplates()
    {
        $foundTemplates = $this->findTemplatesFiles();

        if (!$foundTemplates) {
            $this->notifyNoTemplatesFound();
        } else {
            $this->notifyTemplatesCanBeGenerated($foundTemplates);
        }
    }
961626
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();

		// Register console helper only if console is provided
		$application = $builder->getByType(Application::class, false);

		if ($application !== null) {
			$applicationDef = $builder->getDefinition($application);
			$applicationDef->addSetup(
				new Statement('$service->getHelperSet()->set(?)', [$this->prefix('@configurationHelper')])
			);
		}
	}
1080243
private static function IncludeTemplate(){
            $oThis = self::CreateInstanceIfNotExists();

            $oThis->ReplaceVars();
            $oThis->sBuffer = trim($oThis->sBuffer);
            $Offset = 0;

            while(preg_match('/{include\s*(.*?)}/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $Offset)){
                $sFilename = str_replace(array("'", '"'), "", $aMatches[1][0]);

                if(file_exists($sFilename)){
                    $sBufferAppend = file_get_contents($sFilename);
                    $oThis->sBuffer = str_replace($aMatches[0][0], $sBufferAppend, $oThis->sBuffer);
                }
                else{
                   $oThis->sBuffer = str_replace($aMatches[0][0], "", $oThis->sBuffer);
                }

                $Offset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }
        }