Call Before Rendering ViewModel Itself,
tell viewModel About ParentView that render it.

@param DecorateViewModel $parentView
@param null|iViewModel   $rootPassedToNext

@return void
178735
function delegateRenderBy(DecorateViewModel $parentView, $rootPassedToNext = null)
    {
        if ($rootPassedToNext === null)
            // first segment of list do not pass nextRoot
            $rootPassedToNext = $parentView;

        $this->myRoot   = $rootPassedToNext;
        $this->nextRoot = $parentView;


        if (null ===  $callback = $this->delegateRenderBy )
            return;

        // DO_LEAST_PHPVER_SUPPORT 5.4 closure bindto
        if ($callback instanceof \Closure && version_compare(phpversion(), '5.4.0') > 0) {
            $callback = \Closure::bind(
                $callback
                , $this->_view
                , get_class($this)
            );
        }

        call_user_func($callback, $parentView, $parentView->parent(), $this);
    }
232631
protected function _initParent($message = '', $code = 0, RootException $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }
159351
public function set_parent(Node_Container $parent=null)
	{
		$this->parent = $parent;

		if($parent instanceof Node_Container_Document)
			$this->root = $parent;
		else
			$this->root = $parent->root();
	}
501376
public function parentBlockWidget(BlockView $view, array $variables = [])
    {
        return $this->renderer->searchAndRenderBlock($view, 'widget', $variables, true);
    }
1243170
public function handleChildren($parent, $parentWrapper)
    {
        if ($parent instanceof TaskAdapter) {
            $parent = $parent->getProxy();
        }

        $parentClass = $parent === null ? get_class() : get_class($parent);
        $ih = IntrospectionHelper::getHelper($parentClass);

        for ($i = 0, $childrenCount = count($this->children); $i < $childrenCount; $i++) {
            $childWrapper = $parentWrapper->getChild($i);
            $child = $this->children[$i];

            $realChild = null;
            if ($parent instanceof TaskContainer) {
                $parent->addTask($child);
                continue;
            }

            $project = $this->project === null ? $parent->project : $this->project;
            $realChild = $ih->createElement($project, $parent, $child->getTag());

            $childWrapper->setProxy($realChild);
            if ($realChild instanceof Task) {
                $realChild->setRuntimeConfigurableWrapper($childWrapper);
            }

            $childWrapper->maybeConfigure($this->project);
            $child->handleChildren($realChild, $childWrapper);
        }
    }
821103
public void init(Object parent, Object record)
    {
        super.init(parent, record);
        record = this.getFieldList();   // Created/set in JBaseScreen.init
        this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        FieldTable table = ((FieldList)record).getTable();
        CalendarModel model = this.getCalendarModel(table);
        ImageIcon backgroundImage = null;
        if (this.getBaseApplet() != null)
        	backgroundImage = this.getBaseApplet().getBackgroundImage();	// Calendar panel is transparent, but this helps with rendering see-thru components 
        CalendarPanel panel = new CalendarPanel(model, true, backgroundImage);
        this.add(panel);
    }
215444
@UiThread
    public void expandParent(@NonNull P parent) {
        ExpandableWrapper<P, C> parentWrapper = new ExpandableWrapper<>(parent);
        int flatParentPosition = mFlatItemList.indexOf(parentWrapper);
        if (flatParentPosition == INVALID_FLAT_POSITION) {
            return;
        }

        expandViews(mFlatItemList.get(flatParentPosition), flatParentPosition);
    }
843514
private void recursivelyRemoveNodesFromPage(final DOMNode parent, final SecurityContext securityContext) throws FrameworkException {

		// Remove node from page
		final PropertyMap changedProperties = new PropertyMap();

		changedProperties.put(StructrApp.key(DOMNode.class, "syncedNodes"), Collections.EMPTY_LIST);
		changedProperties.put(StructrApp.key(DOMNode.class, "pageId"),      null);

		parent.setProperties(securityContext, changedProperties);

		// recurse
		for (final DOMNode child : parent.getChildren()) {

			recursivelyRemoveNodesFromPage(child, securityContext);
		}
	}
1203821
public void setParent(HierarchicalFormModel parent) {
		Assert.notNull(parent, "parent");
		this.parent = parent;
		this.parent.addPropertyChangeListener(ENABLED_PROPERTY, parentStateChangeHandler);
		this.parent.addPropertyChangeListener(READONLY_PROPERTY, parentStateChangeHandler);
		enabledUpdated();
		readOnlyUpdated();
	}
836398
protected void nodeCompleted(Object parent, Object node) {
        getProxyBuilder().getCurrentFactory().onNodeCompleted(getProxyBuilder().getChildBuilder(), parent, node);
    }
1251642
protected function _beforeRender(ControllerContext $context)
    {
        $controller = $context->getSubject();

        // Add toolbars on authenticated requests only.
        if ($controller->getUser()->isAuthentic())
        {
            //Add the toolbars
            $toolbars = (array)ObjectConfig::unbox($this->getConfig()->toolbars);

            foreach ($toolbars as $key => $value)
            {
                if (is_numeric($key)) {
                    $this->addToolbar($value);
                } else {
                    $this->addToolbar($key, $value);
                }
            }
        }

        //Add the template filter and inject the toolbars
        if($controller->getView() instanceof ViewTemplatable) {
            $controller->getView()->getTemplate()->addFilter('toolbar', array('toolbars' => $this->getToolbars()));
        }
    }
983131
private function renderParentBlock(Template $parent, $blockName, Context $context)
    {
        while ($parent->parentTemplate) {
            $parent = $this->environment->load($parent->parentTemplate);
            if (isset($parent->blocks[ $blockName ])) {
                $parent->blocks[$blockName]($context);

                return;
            }
        }

        throw new \RuntimeException("Block {$blockName} was not found.");
    }
657138
protected function getHeaderEditButton(ModelInterface $parentModel, EnvironmentInterface $environment)
    {
        $parentDefinition = $environment->getParentDataDefinition();
        /** @var CommandCollectionInterface $commands */
        $commands = $parentDefinition
            ->getDefinition(Contao2BackendViewDefinitionInterface::NAME)
            ->getModelCommands();

        if (!$commands->hasCommandNamed('edit') || !$parentDefinition->getBasicDefinition()->isEditable()) {
            return null;
        }

        $parentName = $environment->getDataDefinition()->getBasicDefinition()->getParentDataProvider();
        $dispatcher = $environment->getEventDispatcher();

        $command    = $commands->getCommandNamed('edit');
        $parameters = (array) $command->getParameters();

        // This should be set in command builder rather than here.
        $parameters['do']    = $environment->getInputProvider()->getParameter('do');
        $parameters['table'] = $parentName;
        $parameters['pid']   = '';

        $extra = (array) $command->getExtra();
        if ($idParam = ($extra['idparam'] ?? null)) {
            $parameters[$idParam] = ModelId::fromModel($parentModel)->getSerialized();
        } else {
            $parameters['id'] = ModelId::fromModel($parentModel)->getSerialized();
        }

        if (null !== ($pid = $this->getGrandParentId($parentDefinition, $parentModel, $environment))) {
            if (false === $pid) {
                return null;
            }
            $parameters['pid'] = $pid;
        }

        /** @var GenerateHtmlEvent $imageEvent */
        $imageEvent = $dispatcher->dispatch(
            ContaoEvents::IMAGE_GET_HTML,
            new GenerateHtmlEvent(
                'edit.svg',
                $this->translate('editheader.0', $parentDefinition->getName())
            )
        );

        $href = '';
        foreach ($parameters as $key => $value) {
            $href .= \sprintf('&%s=%s', $key, $value);
        }
        /** @var AddToUrlEvent $urlAfter */
        $urlAfter = $dispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, new AddToUrlEvent($href));

        return \sprintf(
            '<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a>',
            $urlAfter->getUrl(),
            StringUtil::specialchars(
                \sprintf($this->translate('editheader.1', $parentDefinition->getName()), $parentModel->getId())
            ),
            $imageEvent->getHtml()
        );
    }
1280479
public function parentsUntil($input = null, $selector = null): NodeList {
        return $this->_walkPathUntil('parentNode', $input, $selector);
    }
858029
function viewParentEl(view) {
    var parentView = view.parent;
    if (parentView) {
        return view.parentNodeDef.parent;
    }
    else {
        return null;
    }
}
810168
void setParent(JMFMessageData parent) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "setParent", new Object[] { parent });

        synchronized (getMessageLockArtefact()) {

            // If the parent is a JSMessageData then this is straight forward
            if (parent instanceof JSMessageData) {
                parentMessage = (JSMessageData) parent;
                master = ((JSMessageData) parent).master;
                containingMessage = ((JSMessageData) parent).compatibilityWrapperOrSelf;
            }

            // ... if not, it must be a JSCompatibleMessageImpl, and its encoding must
            // be a JSMessageData, because if it was a JMFEncapsulation it couldn't be our parent
            else {
                JSMessageData msg = (JSMessageData) ((JSCompatibleMessageImpl) parent).getEncodingMessage();
                parentMessage = msg;
                master = msg.master;
                containingMessage = parent;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "setParent");
    }
73653
public function index(PageController $parent_controller, Tree $tree, $block_id, $template) {        
        $view_bag = new ViewBag();
        
        if($parent_controller && $tree) {
        
            $view_bag->set('tree', $tree);
            $view_bag->set('indi', $parent_controller->getSignificantIndividual());
        
            $id = $this->module->getName().$block_id;
            $class = $this->module->getName().'_block';
            $parent_controller->addInlineJavascript('
                jQuery("#maj-new_passwd").hide();
                jQuery("#maj-passwd_click").click(function()
                {
                    jQuery("#maj-new_passwd").slideToggle(100, function() {
                        jQuery("#maj-new_passwd_username").focus();
    			});
    					return false;
    				  });
    			');
    
            if (Auth::isAdmin()) {
                $title='<a class="icon-admin" title="'.I18N::translate('Preferences').'" href="block_edit.php?block_id='.$block_id.'&amp;ged=' . $tree->getNameHtml() . '&amp;ctype=gedcom"></a>';
            } else {
                $title='';
            }
            $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>';
    
            $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
            $view_bag->set('piwik_enabled', $piwik_enabled);
            if($piwik_enabled) {
                $parent_controller->addInlineJavascript(
                    '$("#piwik_stats")
                        .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");'
                );
            }
    
            $content = ViewFactory::make('WelcomeBlock', $this,  new BaseController(), $view_bag)->getHtmlPartial();   
            
            if ($template) {
                return Theme::theme()->formatBlock($id, $title, $class, $content);
            } else {
                return $content;
            }
        }
    }