示例#1
0
 /**
  * Cleans up all properties in the provided node which are used one of the
  * provided widgets
  * @param \ride\library\cms\node\Node $node
  * @param array $unusedWidgetd Array with the widget instance id as key
  * @return boolean Flag to see if the node has changed
  */
 protected function clearWidgetUsage(Node $node, array $unusedWidgets)
 {
     $isChanged = false;
     $isRootNode = $node->getParent() ? false : true;
     $properties = $node->getProperties();
     foreach ($unusedWidgets as $widgetId => $null) {
         foreach ($properties as $key => $property) {
             if (strpos($key, Node::PROPERTY_WIDGET . '.' . $widgetId . '.') === 0 || $isRootNode && $key === Node::PROPERTY_WIDGET . '.' . $widgetId) {
                 $node->set($key, null);
                 $isChanged = true;
             }
         }
     }
     return $isChanged;
 }
 /**
  * Sets a property for the widget
  * @param string $key Key of the property relative to widget.[widgetId].
  * @param mixed $value Value for the property
  * @return null
  */
 public function setWidgetProperty($key, $value = null)
 {
     $this->node->set($this->widgetPropertyPrefix . $key, $value);
 }