Removing all placeholders
@param string|array|null $parent $root or $parent
@throws TemplateException
7464
public function removeAllPlaceholders($parent = null)
    {
        if (isset($parent)) {
            list(, , $template) = $this->getParentPlaceholder($parent);
        }

        if (!isset($template)) {
            $template = $this;
        }
        if ($template === false) {
            if ($this->throwException) {
                if (is_array($parent)) {
                    $parent = implode('.', $parent);
                }
                throw new TemplateException("Unknown scope: {$parent}");
            }
            return;
        }
        $template->placeholders = [];
    }
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;
            }
        }
    }
1007625
function root()
    {
        // change template to login layout
        $root = $this;
        while( $next = $root->parent() )
            $root = $next;

        return ($root === $this) ? null : $root;
    }
194222
public function destroy($parent = null, $model = null)
    {
        if ($this->repository->delete($model)) {
            return back();
        }
    }
571397
@SuppressWarnings("unchecked")
  public void setParent(PvmExecutionImpl parent) {
    PvmExecutionImpl currentParent = getParent();

    setParentExecution(parent);

    if (currentParent != null) {
      currentParent.getExecutions().remove(this);
    }

    if (parent != null) {
      ((List<PvmExecutionImpl>) parent.getExecutions()).add(this);
    }
  }
639647
function _displayTree($tree, $parent = NULL) {
        $outputList = TRUE;
        foreach ($tree as $name => $element) {
            if ($element->superclass() == $parent) {
                if ($outputList)
                    echo "<ul>\n";
                echo "<li><a href=\"", $this->_asURL($element), "\">", $element->qualifiedName(), "</a>";
                $this->_displayTree($tree, $name);
                echo "</li>\n";
                $outputList = FALSE;
            }
        }
        if (!$outputList)
            echo "</ul>\n";
    }
1363827
public static void pruneMenus(BaseComponent parent) {
        while (parent != null && parent instanceof BaseMenuComponent) {
            if (parent.getChildren().isEmpty()) {
                BaseComponent newParent = parent.getParent();
                parent.destroy();
                parent = newParent;
            } else {
                break;
            }
        }
    }
432116
protected function _cleanEmptyParents($dom, $parentXPath, $childXPath)
    {
        $xPath = new DomXPath($dom);
        $nodeList = $xPath->query($parentXPath);

        foreach ($nodeList as $node) {
            $id = $node->getAttribute('id');
            $childList = $xPath->query("{$parentXPath}[@id='$id']/$childXPath");
            if (!$childList->length) {
                $node->parentNode->removeChild($node);
            }
        }
    }
853457
protected function writeArgs(DOMElement $parent)
    {
        $args = $this->getArgs();
        if (count($args) > 0) {
            $dom = $parent->ownerDocument;
            $argBase = $dom->createElement('arg');
            foreach ($args as $key => $value) {
                $arg = clone $argBase;
                $arg->setAttribute('name', $key);

                if ($this instanceof CustomArgInterface && $this->flagUseCustomArgWriter($key, $value)) {
                    $this->buildArgValue($key, $value, $arg);
                } else {
                    $valueArgElement = $dom->createTextNode($value);
                    $arg->appendChild($valueArgElement);
                }

                $parent->appendChild($arg);
            }
        }
    }
1174681
public function setParent($parent)
    {
        if ($parent !== null &&  !$parent instanceof BaseEntry) {
            throw new \InvalidArgumentException('An entry may only have another entry as parent');
        }

        $this->parent = $parent;
    }
138089
public static function replaceTpl($content, array $placeholders = null, Template $template)
    {
        $template = clone $template;
        $template->removeAllPlaceholders();

        return $template->replace($content, $placeholders);
    }
82458
protected function _constructStringParentStringChild($parent, $child = null)
    {
        // obtain ref to the filesystem layer
        $fs = FileSystem::getFileSystem();

        if ($child === null) {
            throw new NullPointerException("Argument to function must not be null");
        }
        if ($parent !== null) {
            if ($parent === "") {
                $this->path = $fs->resolve($fs->getDefaultParent(), $fs->normalize($child));
            } else {
                $this->path = $fs->resolve($fs->normalize($parent), $fs->normalize($child));
            }
        } else {
            $this->path = (string) $fs->normalize($child);
        }
        $this->prefixLength = (int) $fs->prefixLength($this->path);
    }
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);
    }
677128
public function setParent(&$parent)
	{
		JLog::add('JNode::setParent() is deprecated.', JLog::WARNING, 'deprecated');

		if ($parent instanceof JNode || is_null($parent))
		{
			$hash = spl_object_hash($this);

			if (!is_null($this->_parent))
			{
				unset($this->_parent->children[$hash]);
			}

			if (!is_null($parent))
			{
				$parent->_children[$hash] = & $this;
			}

			$this->_parent = & $parent;
		}
	}
478375
public function ensureUserGroupDoesntExist( $name, $parentGroupName = null )
    {
        $repository = $this->getRepository();
        $userService = $repository->getUserService();

        if ( $parentGroupName )
        {
            // find parent group name
            $searchResults = $this->searchUserGroups( $parentGroupName );
            if ( empty( $searchResults ) )
            {
                throw new \Exception( "Could not find parent User Group with name '$name'." );
            }

            $parentGroupLocationId = $searchResults[0]->valueObject->contentInfo->mainLocationId;
        }
        else
        {
            $parentGroupLocationId = null;
        }

        $searchResults = $this->searchUserGroups( $name, $parentGroupLocationId );

        if ( empty( $searchResults ) )
        {
            // no existing User Groups found
            return;
        }
        // else, remove existing groups
        $repository->sudo(
            function() use( $searchResults, $userService )
            {
                foreach ( $searchResults as $searchHit )
                {
                    //Attempt to delete User Group
                    try
                    {
                        $userGroup = $userService->loadUserGroup( $searchHit->valueObject->contentInfo->id );
                        $userService->deleteUserGroup( $userGroup );
                    }
                    catch ( ApiExceptions\NotFoundException $e )
                    {
                        // nothing to do
                    }
                }
            }
        );
    }
1032493
private function process(array $element, $parent = null)
    {
        $apiElement = $element['element'];

        if (isset($this->elementMap[$apiElement])) {
            $this->processElement(
                $element,
                $this->elementMap[$apiElement],
                $parent
            );
        }

        if ($element['element'] === 'category') {
            // todo extend the element map to check for classes, then merge processCategory into processElement
            $this->processCategory($element, $parent);
        }
    }
1233777
public function setRoot($root)
    {
        // do nothing if root isn't a valid prefix
        if (empty($root)) {
            return null;
        }

        // Kill slash padding and add a trailing slash afterwards
        $root = trim($root, '/');
        $root .= '/';
        $this->root = $root;
    }