eZ\Publish\Core\FieldType\Page\Parts\Item::getState PHP Метод

getState() публичный Метод

Returns available properties with their values as a simple hash.
public getState ( ) : array
Результат array
    public function getState()
    {
        $hash = array();
        foreach ($this->getProperties() as $property) {
            $hash[$property] = $this->{$property};
        }
        return $hash;
    }

Usage Example

Пример #1
0
 /**
  * Generates XML string for a given $item object
  *
  * @param \eZ\Publish\Core\FieldType\Page\Parts\Item $item
  * @param \DOMDocument $dom
  *
  * @return boolean|\DOMElement
  */
 protected function generateItemXmlString(Parts\Item $item, DOMDocument $dom)
 {
     $itemNode = $dom->createElement('item');
     foreach ($item->getState() as $attrName => $attrValue) {
         switch ($attrName) {
             case 'action':
                 if ($attrValue !== null) {
                     $itemNode->setAttribute('action', $attrValue);
                 }
                 break;
             case 'contentId':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'object_id', $attrValue);
                 break;
             case 'locationId':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'node_id', $attrValue);
                 break;
             case 'priority':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'priority', $attrValue);
                 break;
             case 'publicationDate':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_publication', $attrValue);
                 break;
             case 'visibilityDate':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_visible', $attrValue);
                 break;
             case 'hiddenDate':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_hidden', $attrValue);
                 break;
             case 'rotationUntilDate':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'rotation_until', $attrValue);
                 break;
             case 'movedTo':
                 $this->addNewNotEmptyXmlElement($dom, $itemNode, 'moved_to', $attrValue);
                 break;
             case 'attributes':
                 foreach ($attrValue as $arrayItemKey => $arrayItemValue) {
                     $this->addNewNotEmptyXmlElement($dom, $itemNode, $arrayItemKey, $arrayItemValue);
                 }
                 break;
         }
     }
     return $itemNode;
 }
All Usage Examples Of eZ\Publish\Core\FieldType\Page\Parts\Item::getState