Reassigns contents by area names if layout was changed
@param Layout $prevLayout The old layout
@param Layout $newLayout The new layout
764121
private function ReassignContents(Layout $prevLayout, Layout $newLayout)
    {
        if ($prevLayout->Equals($newLayout)) {
            return;
        }
        $oldAreas = Area::Schema()->FetchByLayout(false, $prevLayout);
        
        foreach ($oldAreas as $oldArea)
        {
            $newArea = $this->FindNewArea($oldArea, $newLayout);
            if ($newArea) {
                $this->TransferArea($oldArea, $newArea);
            }
            else{
                $this->ClearArea($oldArea);
            }
        }
     }
1086867
protected function regionUpdate(Layout $layout, Region $region)
    {
        if ($region->isUpdated()) {

            $this
                ->db
                ->delete('ucms_layout_data')
                ->condition('layout_id', $layout->getId())
                ->condition('region', $region->getName())
                ->execute()
            ;

            $values = [];

            /* @var $item Item */
            foreach ($region as $delta => $item) {
                $values[] = [
                    $layout->getId(),
                    $region->getName(),
                    $item->getNodeId(),
                    $delta,
                    $item->getViewMode(),
                ];
            }

            if (!empty($values)) {
                $q = $this->db->insert('ucms_layout_data');
                $q->fields(['layout_id', 'region', 'nid', 'weight', 'view_mode']);
                foreach ($values as $row) {
                    $q->values($row);
                }
                $q->execute();
            }

            // And create the node references

            $region->toggleUpdateStatus(false);

            return true;
        }

        return false;
    }
746262
public function renameSequence($oldName, $newName)
    {
        if (!$this->hasSequence($oldName)) {
            throw SchemaException::schemaSequenceDoesNotExist($this->getName(), $oldName);
        }

        if ($this->hasSequence($newName)) {
            throw SchemaException::schemaSequenceAlreadyExists($this->getName(), $newName);
        }

        $this->sequences[$oldName]->setName($newName);
        $this->sequences[$newName] = $this->sequences[$oldName];

        unset($this->sequences[$oldName]);
    }
835543
public function setLayout($layout)
    {
        $extensions = ['.php', '.phtml', '.html', '.tpl'];

        if (isset($this->presets[ 'extensions' ])) {
            array_unshift($partialsExtensions, $this->presets[ 'extension' ]);
        } elseif (isset($this->presets[ 'extension' ])) {
            array_unshift($extensions, $this->presets[ 'extension' ]);
        }

        foreach ($extensions as $extension) {
            $extension = trim($extension, '.');

            if ($layout === 'theme') {
                $layoutFilePath = $this->getRealPath() . 'theme.' . $extension;
            } else {
                $layoutFilePath = $this->getRealPath() . 'layouts' . DIRECTORY_SEPARATOR . dash($layout) . DIRECTORY_SEPARATOR . 'layout.' . $extension;
            }

            if (is_file($layoutFilePath)) {
                $this->layout = new Theme\Layout($layoutFilePath);
                //$this->loadLayout();
                break;
            }
        }

        return $this;
    }
673042
protected function initializeLayout(FieldsBuilder $layout, $args = [])
    {
        $layout->setGroupConfig('name', $layout->getName());
        $layout->setGroupConfig('display', 'block');

        foreach ($args as $key => $value) {
            $layout->setGroupConfig($key, $value);
        }

        $layout->setParentContext($this);

        return $layout;
    }
172652
protected function extends($layout)
    {
        if ($this->extends !== false) {
            throw new Templating_Exception($this->current_view . ' is attempting to extend multiple layouts.');
        }
        $this->extends = $this->get_template_name($layout);
    }
836937
final public function setLayout($layoutName)
    {
        $layoutNamespace = Configuration::read('mvc.layout.namespace');
        $layoutNamespace = $layoutNamespace . '\\' . $layoutName;
        $this->layout = new $layoutNamespace($this->view);
        // To maintain compatibility with version 1.0
        $this->Layout = $this->layout;
    }
241200
void setWorkbenchLayout(Layout layout) {
		validateNotNull(layout, "layout");

		if (this.layout == layout) {
			return;
		}

		requestTabIndex = getCurrentRequestTabIndex();

		Layout previousLayout = this.layout;
		this.layout = layout;

		componentMaximiser.unmaximiseComponent();
		removeAll();

		List<AbstractPanel> visiblePanels;
		switch (layout) {
		case FULL:
			visiblePanels = getTabbedStatus().getVisiblePanels();
			getTabbedStatus().hideAllTabs();
			visiblePanels.addAll(getTabbedWork().getVisiblePanels());
			getTabbedWork().hideAllTabs();
			visiblePanels.addAll(getTabbedSelect().getVisiblePanels());
			getTabbedSelect().hideAllTabs();
			getTabbedFull().setVisiblePanels(visiblePanels);
			updateFullLayout();
			this.add(getFullLayoutPanel());
			break;
		case EXPAND_SELECT:
		case EXPAND_STATUS:
		default:
			this.add(layout == Layout.EXPAND_STATUS ? createStatusPanelsSplit() : createSelectPanelsSplit());

			if (previousLayout == Layout.FULL) {
				visiblePanels = getTabbedFull().getVisiblePanels();
				getTabbedFull().hideAllTabs();
				getTabbedStatus().setVisiblePanels(visiblePanels);
				getTabbedWork().setVisiblePanels(visiblePanels);
				getTabbedSelect().setVisiblePanels(visiblePanels);

				setResponsePanelPosition(responsePanelPosition);
			}
			break;
		}

		this.validate();
		this.repaint();
	}
403625
public boolean removeLayout(final Layout layout) {
        boolean removed = mLayouts.remove(layout);
        if (layout != null && removed) {
            layout.onLayoutApplied(null, new Vector3Axis());
        }
        return removed;
    }
291801
@Override
    public String removeLayoutAttribute(String nodeId, String name) {
        Validate.notEmpty(nodeId, "nodeId cannot be null");
        Validate.notEmpty(name, "name cannot be null");

        final LayoutNodeAttributesImpl layoutAttribute = getLayoutNodeAttributes(nodeId, false);
        if (layoutAttribute == null) {
            return null;
        }
        final Map<String, String> attributes = layoutAttribute.getAttributes();
        return attributes.remove(name);
    }
1194346
public void replace(Card oldOne, Card newOne) {
        VirtualLayoutManager layoutManager = getLayoutManager();
        if (oldOne != null && newOne != null && mGroupBasicAdapter != null && layoutManager != null) {
            List<LayoutHelper> layoutHelpers = layoutManager.getLayoutHelpers();
            int cardIdx = mGroupBasicAdapter.findCardIdxForCard(oldOne);
            if (layoutHelpers != null && cardIdx >= 0 && cardIdx < layoutHelpers.size()) {
                final List<LayoutHelper> newLayoutHelpers = new LinkedList<>();
                for (int i = 0, size = layoutHelpers.size(); i < size; i++) {
                    LayoutHelper layoutHelper = layoutHelpers.get(i);
                    if (i == cardIdx) {
                        layoutHelper = newOne.getLayoutHelper();
                    }
                    newLayoutHelpers.add(layoutHelper);
                }
                layoutManager.setLayoutHelpers(newLayoutHelpers);
                mGroupBasicAdapter.replaceComponent(oldOne, newOne);
            }
        }
    }
591190
public void setLayout(String layout)
    {
        if (layout == null)
        {
            String message = Logging.getMessage("nullValue.StringIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        if (!this.layout.equals(layout))
        {
            this.layout = layout;
            clearControls();
        }
    }
568699
@Override
    public String removeLayoutAttribute(String nodeId, String name) {
        Validate.notEmpty(nodeId, "nodeId cannot be null");
        Validate.notEmpty(name, "name cannot be null");

        final Map<String, String> nodeAttributes = this.layoutAttributes.get(nodeId);
        if (nodeAttributes == null) {
            return null;
        }

        return nodeAttributes.remove(name);
    }
900268
static function LayoutTemplate(Layout $layout)
    {
        $folder = Path::Combine(PHINE_PATH, 'App/Phine/LayoutTemplates');
        $file = Path::Combine($folder, $layout->GetName());
        return Path::AddExtension($file, 'phtml');
    }
1164008
private function onPropertyChanged($name, $oldValue, $newValue)
    {
        foreach ($this->listeners as $listener) {
            $listener->propertyChanged($this, $name, $oldValue, $newValue);
        }
    }
712878
public function setViewLayout($view)
    {
        $this->layout         = $this->viewLayout->change($view);
        $this->layout->layout = $this->viewPath->setUp($this->layout->layout, null);
    }
1130605
private function updateLayoutModifiedDate(Layout $layout): void
    {
        $updatedLayout = clone $layout;
        $updatedLayout->modified = time();
        $this->queryHandler->updateLayout($updatedLayout);
    }