Return "after" and "before" children,
based on contextual View and its Templates.

@return array
11502
public function getChildren(WidgetMap $widgetMap, View $view = null)
    {
        $positions = [WidgetMap::POSITION_BEFORE, WidgetMap::POSITION_AFTER];
        $children = [];
        foreach ($positions as $position) {
            $matchingChildren = [];

            //Position is null by default
            $children[$position] = null;

            //Pass through all current WidgetMap children for a given position
            foreach ($widgetMap->getContextualChildren($position) as $_child) {
                //If child don't have a substitute for this View and Templates, this is the one
                if (null === $_child->getSubstituteForView($view)) {
                    $children[$position] = $_child;
                    $matchingChildren[] = $_child->getId();
                }
            }

            //If children has not been found for this position
            //and current WidgetMap is a substitute
            if (!$children[$position] && $widgetMap->getReplaced()) {
                //Pass through all replaced WidgetMap children for a given position
                foreach ($widgetMap->getReplaced()->getContextualChildren($position) as $_child) {
                    //If child don't have a substitute for this View and Templates, this is the one
                    if (null === $_child->getSubstituteForView($view)) {
                        $children[$position] = $_child;
                        $matchingChildren[] = $_child->getId();
                    }
                }
            }

            $matchingChildren = array_unique($matchingChildren);
            if (count($matchingChildren) > 1) {
                $this->logger->critical(sprintf(
                    'Conflict found between WidgetMaps %s for View %s',
                    implode(', ', $matchingChildren),
                    $view->getId()
                ));
            }
        }

        return $children;
    }
684778
public function findAllTemplates()
    {
        if (null !== $this->templates) {
            return $this->templates;
        }

        $templates = array();

        foreach ($this->paths as $dir) {
            $templates = array_merge($templates, $this->findTemplatesInFolder($dir));
        }

        return $this->templates = $templates;
    }
24993
public function children()
    {
        return $this->subChildren()
            ->with(['children' => function ($query) {
                $query->select(get_class($this)::getFillableFields());
            }])
            ->select(get_class($this)::getFillableFields());
    }
312782
public function getExtraTemplates($view)
    {
        if (empty($this->extraTemplates[$view])) {
            $this->extraTemplates[$view] = [];
        }

        return $this->extraTemplates[$view];
    }
7373
public function after() {
		if($this->_handle_ajax == true)
		{
			if($this->request->is_ajax())
			{
				$return = array();

				if(RD::has_messages() == false)
				{
					$return['status'] = 'success';
					$return['response'] = [''];
				}
				else if(RD::get_current(RD::ERROR) != null)
				{
					$return['status'] = 'error';
					$return['errors'] = RD::get_current(RD::ERROR);
				}
				else if(RD::get_current(array(RD::SUCCESS, RD::INFO)) != null)
				{
					$return['status'] = 'success';
					$return['response'] = RD::get_current(array(RD::SUCCESS, RD::INFO, RD::WARNING));
				}
				else
				{
					$return['status'] = 'success';
					$return['response'] = RD::get_current();
				}

				$this->response->headers('Content-Type', 'application/json');
				$this->response->body(json_encode($return));
			}
			else
			{
				//otherwise flash the messages so they can be used on the next page load
				if(RD::has_messages())
					RD::persist();

				parent::after();
			}
		}
		else
			parent::after();
	}
481794
private function diff(string $before, string $after): array
    {
        $diff = $this->differ->diffToArray(
            $before,
            $after
        );

        return \array_map(static function (array $element) {
            static $templates = [
                0 => ' %s',
                1 => '<fg=green>+%s</>',
                2 => '<fg=red>-%s</>',
            ];

            [$token, $status] = $element;

            $template = $templates[$status];

            return \sprintf(
                $template,
                $token
            );
        }, $diff);
    }
560316
public function getTemplatesToGenerate()
    {
        return parent::getTemplatesToGenerate() + array(
            'ListBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/index.html.twig',
            'List/FiltersBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/filters.html.twig',
            'List/ResultsBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/results.html.twig',
            'List/RowBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/row.html.twig',
        );
    }
40787
public function getSelfBlameableRules()
    {
        if (!is_string($this->parentAttribute)) {
            return [];
        }
        if (!empty($this->localSelfBlameableRules) && is_array($this->localSelfBlameableRules)) {
            return $this->localSelfBlameableRules;
        }
        if (is_string($this->parentAttributeRule)) {
            $this->parentAttributeRule = [$this->parentAttributeRule];
        }
        $this->localSelfBlameableRules = [
            array_merge([$this->parentAttribute], $this->parentAttributeRule),
        ];
        return $this->localSelfBlameableRules;
    }
267560
public function get_child_contexts() {
        global $DB;

        debugging('Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!');

        // Just get all the contexts except for CONTEXT_SYSTEM level
        // and hope we don't OOM in the process - don't cache
        $sql = "SELECT c.*
                  FROM {context} c
                 WHERE contextlevel > ".CONTEXT_SYSTEM;
        $records = $DB->get_records_sql($sql);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }
61351
public function children()
    {
        return $this->menu->items->filter(function ($item) {
            return $item->hasParent() && $item->parent->name == $this->name;
        });
    }
124316
protected function children()
    {
        if (($item = $this->getModel()) && method_exists($item, $this->name)) {
            return $item->{$this->name};
        }
    }
179073
protected function _getListOptionsForElem() {
		$cachePath = 'DefaultOptions_ViewExt_' . $this->_currUIlang;
		$cached = Cache::read($cachePath, CAKE_THEME_CACHE_KEY_HELPERS);
		if (!empty($cached)) {
			return $cached;
		}

		$result = [];
		$result['yesNo'] = [
			'yes' => __d('view_extension', 'Yes'),
			'no' => __d('view_extension', 'No')
		];
		$result['showEmpty'] = __d('view_extension', '&lt;None&gt;');
		$result['popupModalLink'] = [
			'escape' => false,
			'class' => 'popup-link',
			'target' => '_blank',
			'data-popover-placement' => 'auto top',
			'data-modal-title' => __d('view_extension', 'Detail information'),
		];
		$result['popupLink'] = [
			'escape' => false,
			'class' => 'popup-link',
			'target' => '_blank',
			'data-popover-placement' => 'auto top',
		];
		$result['modalLink'] = [
			'escape' => false,
			'data-modal-title' => __d('view_extension', 'Detail information'),
		];
		$result['confirmLink'] = [
			'escape' => false,
			'data-confirm-msg' => __d('view_extension', 'Are you sure you wish to delete this data?'),
			'data-confirm-btn-ok' => __d('view_extension', 'Yes'),
			'data-confirm-btn-cancel' => __d('view_extension', 'No')
		];
		$result['paginationSortPjax'] = [
			'linkOpt' => [
				'title' => __d('view_extension', 'Click to sort by this fiels'),
				'data-toggle' => 'pjax'
			],
			'iconDir' => [
				'asc' => $this->iconTag('fas fa-long-arrow-alt-up'),
				'desc' => $this->iconTag('fas fa-long-arrow-alt-down'),
			]
		];
		$result['truncateText'] = [
			'truncateOpt' => [
				'ellipsis' => $this->Html->link($this->iconTag('fas fa-angle-double-right'), '#', [
					'role' => 'button',
					'escape' => false,
					'data-toggle' => 'collapse-text-expand',
					'class' => 'collapse-text-action-btn',
					'title' => __d('view_extension', 'Expand text')
					]),
				'exact' => false,
				'html' => true
			],
			'collapseLink' => $this->Html->link($this->iconTag('fas fa-angle-double-left'), '#', [
				'role' => 'button',
				'escape' => false,
				'data-toggle' => 'collapse-text-roll-up',
				'class' => 'collapse-text-action-btn',
				'title' => __d('view_extension', 'Roll up text')
			])
		];
		$result['form'] = [
			'role' => 'form',
			'requiredcheck' => true,
			'data-required-msg' => __d('view_extension', 'Please fill in this field'),
		];
		$result['barPaging'] = [
			'firstPage' => [
				'icon' => $this->iconTag('fas fa-angle-double-left'),
				'linkOpt' => [
					'tag' => 'li',
					'escape' => false,
					'title' => __d('view_extension', 'First page'),
					'data-toggle' => 'tooltip',
				]
			],
			'previousPage' => [
				'icon' => $this->iconTag('fas fa-angle-left'),
				'linkOpt' => [
					'tag' => 'li',
					'escape' => false,
					'title' => __d('view_extension', 'Previous page'),
					'data-toggle' => 'tooltip',
				]
			],
			'numbers' => [
				'separator' => '',
				'ellipsis' => '...',
				'tag' => 'li',
				'currentLink' => true,
				'currentClass' => 'active',
				'currentTag' => 'a'
			],
			'nextPage' => [
				'icon' => $this->iconTag('fas fa-angle-right'),
				'linkOpt' => [
					'tag' => 'li',
					'escape' => false,
					'title' => __d('view_extension', 'Next page'),
					'data-toggle' => 'tooltip',
				]
			],
			'lastPage' => [
				'icon' => $this->iconTag('fas fa-angle-double-right'),
				'linkOpt' => [
					'tag' => 'li',
					'escape' => false,
					'title' => __d('view_extension', 'Last page'),
					'data-toggle' => 'tooltip',
				]
			],
			'showList' => [
				'icon' => $this->iconTag('fas fa-align-justify'),
				'linkOpt' => [
					'title' => __d('view_extension', 'Show as list'),
					'escape' => false
				]
			],
			'goToPage' => [
				'link' => $this->Html->link(
					$this->iconTag('fas fa-ellipsis-h'),
					'#',
					[
						'role' => 'button',
						'escape' => false,
						'data-toggle' => 'collapse',
						'aria-expanded' => 'false',
						'data-target' => '.control-go-to-page',
						'title' => __d('view_extension', 'Go to the page'),
					]
				),
				'spin' => [
					'id' => 'gotopagebar',
					'class' => 'input-sm',
					'autocomplete' => 'off',
					'min' => '1',
					'step' => '1',
					'verticalbuttons' => 'false',
					'postfix' => $this->iconTag('fas fa-share'),
					'postfix_extraclass' => 'btn btn-default btn-go-to-page',
					'title' => __d('view_extension', 'The page number to quickly jump')
				]
			],
			'numLines' => [
				'id' => 'numlinesbar',
				'type' => 'select',
				'style' => 'btn-default btn-sm',
				'width' => false,
				'live-search' => false,
				'size' => 'auto',
				'class' => 'form-control show-tick filter-condition input-sm',
				'autocomplete' => 'off',
				'div' => false,
				'label' => false,
				'title' => __d('view_extension', 'Number of lines'),
			]
		];
		$result['buttonsMove'] = [
			'btnDrag' => $this->buttonLink(
				'fas fa-arrows-alt',
				'btn-primary',
				'#',
				[
					'role' => 'button',
					'data-toggle' => 'drag',
					'title' => __d('view_extension', 'Drag and drop this item'),
				]
			),
			'btnsMove' => [
				[
					'icon' => 'fas fa-angle-double-up',
					'title' => __d('view_extension', 'Move top'),
					'url' => ['top']
				],
				[
					'icon' => 'fas fa-angle-up',
					'title' => __d('view_extension', 'Move up'),
					'url' => ['up']
				],
				[
					'icon' => 'fas fa-angle-down',
					'title' => __d('view_extension', 'Move down'),
					'url' => ['down']
				],
				[
					'icon' => 'fas fa-angle-double-down',
					'title' => __d('view_extension', 'Move bottom'),
					'url' => ['bottom']
				],
			]
		];
		$result['loadMore'] = [
			'linkTitle' => __d('view_extension', 'Load more'),
			'linkOpt' => [
				'role' => 'button',
				'data-toggle' => 'load-more',
				'title' => __d('view_extension', 'Load more informations')
			]
		];
		$result['btnPrint'] = $this->button(
			'fas fa-print fa-lg',
			'btn btn-default',
			[
				'data-toggle' => 'print',
				'class' => 'view-extension-print-btn',
				'title' => __d('view_extension', 'Print this page')
			]
		);
		$result['btnHeaderMenu'] = $this->ExtBs3Form->button(
			$this->iconTag('fas fa-bars fa-lg') . '&nbsp;' .
			$this->Html->tag('span', '', ['class' => 'caret']),
			[
				'type' => 'button',
				'class' => 'btn btn-default dropdown-toggle',
				'data-toggle' => 'dropdown',
				'title' => __d('view_extension', 'Menu of operations'),
				'aria-haspopup' => 'true',
				'aria-expanded' => 'false',
				'id' => 'pageHeaderMenu'
			]
		);
		Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

		return $result;
	}
424416
public function getTreePathRows()
    {
        $parts = array($this);
        $upperRow = $this;
        while (!is_null($upperRow = $upperRow->getParentNode())) {
            $parts[] = $upperRow;
        }
        return array_reverse($parts);
    }
705210
public function getChildren()
    {
        if ($this->children === null) {
            $this->setChildren($this->environmentRepository->getAllChildren($this));
        }
        return $this->children;
    }
392123
public function getListItemButtons()
    {
        $buttons = ArrayList::create();
        
        foreach ($this->owner->getListItemButtonsConfig() as $name => $spec) {
            
            if ($spec) {
                
                foreach ($spec as $item => $value) {
                    
                    $args = [];
                    
                    if (is_array($value)) {
                        $args  = $value;
                        $value = array_shift($args);
                    }
                    
                    $spec[$item] = $this->processListItemValue($value, $args);
                    
                }
                
                if (isset($spec['show']) && !$this->owner->{$spec['show']}) {
                    continue;
                }
                
                $href = isset($spec['href']) ? $spec['href'] : null;
                
                $type  = null;
                $extra = null;
                
                if ($renderer = $this->owner->getRenderer()) {
                    $type  = $renderer->ButtonTypeStyle;
                    $extra = $renderer->ButtonExtraClass;
                }
                
                if ($href) {
                    
                    $buttons->push(
                        ArrayData::create([
                            'Icon' => isset($spec['icon']) ? $spec['icon'] : null,
                            'Type' => isset($spec['type']) ? $spec['type'] : $type,
                            'HREF' => isset($spec['href']) ? $spec['href'] : null,
                            'Text' => isset($spec['text']) ? $spec['text'] : null,
                            'ExtraClass' => isset($spec['extraClass']) ? $spec['extraClass'] : $extra
                        ])
                    );
                    
                }
                
            }
            
        }
        
        return $buttons;
    }
10077
public function getTemplates()
    {
        $templates = array();

        if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {
            while (false !== ($entry = readdir($handle))) {
                if (substr($entry, 0, 1) !== '.') {
                    $templates[] = array(
                        'id' => $entry,
                        'title' => preg_replace('/[^A-Za-z0-9]/', ' ', $entry),
                    );
                }
            }

            closedir($handle);
        }

        return $templates;
    }
768623
private function getType(): array
    {
        if (!$this->type || $this->is('customize_preview')) {
            $this->type = parent::type();
        }

        return $this->type;
    }