Skip to content

Commit

Permalink
Cosider policy as well
Browse files Browse the repository at this point in the history
  • Loading branch information
suffle committed Dec 21, 2021
1 parent dad4117 commit 07d3cfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,16 @@ protected function getBasicNodeInformation(NodeInterface $node): array
$parent = $node->getParent();
$isAutoCreated = $node->isAutoCreated();
$parentOptions = $parent ? $parent->getNodeType()->getOptions() : [];

$hasAllowHideAutoCreatedOption = isset($parentOptions['allowHideAutoCreatedChildNodes']) && $parentOptions['allowHideAutoCreatedChildNodes'] === true;
$policyForbidsHiding = in_array('_hidden', $this->nodePolicyService->getDisallowedProperties($node));
return [
'contextPath' => $node->getContextPath(),
'name' => $node->getName(),
'identifier' => $node->getIdentifier(),
'nodeType' => $node->getNodeType()->getName(),
'label' => $node->getLabel(),
'isAutoCreated' => $isAutoCreated,
'disableChangeVisibility' => $isAutoCreated && !(isset($parentOptions['allowHideAutoCreatedChildren']) && $parentOptions['allowHideAutoCreatedChildren'] === true),
'disableChangeVisibility' => $policyForbidsHiding || ($isAutoCreated && !$hasAllowHideAutoCreatedOption),
'depth' => $node->getDepth(),
'children' => [],
// In some rare cases the parent node cannot be resolved properly
Expand Down
4 changes: 2 additions & 2 deletions packages/neos-ui-guest-frame/src/InlineUI/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {$transform, $get, $contains} from 'plow-js';
import {$transform, $get} from 'plow-js';
import {actions, selectors} from '@neos-project/neos-ui-redux-store';
import {neos} from '@neos-project/neos-ui-decorators';

Expand Down Expand Up @@ -53,7 +53,7 @@ export default class InlineUI extends PureComponent {
const isCopied = allFocusedNodesAreInClipboard && clipboardMode === 'Copy';
const canBeDeleted = $get('policy.canRemove', this.props.focusedNode) || false;
const canBeEdited = $get('policy.canEdit', this.props.focusedNode) || false;
const visibilityCanBeToggled = !$contains('_hidden', 'policy.disallowedProperties', this.props.focusedNode) && !$get('disableChangeVisibility', this.props.focusedNode);
const visibilityCanBeToggled = !$get('disableChangeVisibility', this.props.focusedNode);

return (
<div className={style.inlineUi} data-__neos__inline-ui="TRUE">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ const removeAllowed = (focusedNodesContextPaths, state) => focusedNodesContextPa
const visibilityToggleAllowed = (focusedNodesContextPaths, state) => focusedNodesContextPaths.every(contextPath => {
const getNodeByContextPathSelector = selectors.CR.Nodes.makeGetNodeByContextPathSelector(contextPath);
const focusedNode = getNodeByContextPathSelector(state);
return !$contains('_hidden', 'policy.disallowedProperties', focusedNode) && !$get('disableChangeVisibility', focusedNode);
console.log(focusedNode);
return !$get('disableChangeVisibility', focusedNode);
});
const editingAllowed = (focusedNodesContextPaths, state) => focusedNodesContextPaths.every(contextPath => {
const getNodeByContextPathSelector = selectors.CR.Nodes.makeGetNodeByContextPathSelector(contextPath);
Expand Down

0 comments on commit 07d3cfc

Please sign in to comment.