/**
  * Handles the input specific for one attribute from the class edit interface.
  *
  * @param eZHTTPTool $http
  * @param string $base Seems to be always 'ContentClassAttribute'.
  * @param eZContentClassAttribute $classAttribute
  * @return void
  */
 public function fetchClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     // Comments default activation
     $activationFieldName = $base . self::COMMENTS_ENABLED_VARIABLE . $classAttribute->attribute('id');
     if ($http->hasPostVariable($activationFieldName)) {
         $classAttribute->setAttribute(self::CLASSATTRIBUTE_COMMENTS_ACTIVATED_DEFAULT_FIELD, 1);
     }
 }
Beispiel #2
0
 /**
  * Extracts values from the attribute parameters and sets it in the class attribute.
  *
  * @param eZContentClassAttribute $classAttribute
  * @param DOMElement $attributeNode
  * @param DOMElement $attributeParametersNode
  */
 public function unserializeContentClassAttribute($classAttribute, $attributeNode, $attributeParametersNode)
 {
     /** @var $domNodes DOMNodeList */
     $subTreeLimit = 0;
     $domNodes = $attributeParametersNode->getElementsByTagName('subtree-limit');
     if ($domNodes->length > 0) {
         $subTreeLimit = (int) $domNodes->item(0)->textContent;
     }
     $maxTags = 0;
     $domNodes = $attributeParametersNode->getElementsByTagName('max-tags');
     if ($domNodes->length > 0) {
         $maxTags = (int) $domNodes->item(0)->textContent;
     }
     $showDropDown = 0;
     $domNodes = $attributeParametersNode->getElementsByTagName('dropdown');
     if ($domNodes->length > 0 && $domNodes->item(0)->textContent === 'true') {
         $showDropDown = 1;
     }
     $hideRootTag = 0;
     $domNodes = $attributeParametersNode->getElementsByTagName('hide-root-tag');
     if ($domNodes->length > 0 && $domNodes->item(0)->textContent === 'true') {
         $hideRootTag = 1;
     }
     $classAttribute->setAttribute(self::SUBTREE_LIMIT_FIELD, $subTreeLimit);
     $classAttribute->setAttribute(self::MAX_TAGS_FIELD, $maxTags);
     $classAttribute->setAttribute(self::SHOW_DROPDOWN_FIELD, $showDropDown);
     $classAttribute->setAttribute(self::HIDE_ROOT_TAG_FIELD, $hideRootTag);
 }
 /**
  * Fetches all variables inputed on content class level
  * return true if fetching of class attributes are successfull, false if not
  *
  * @param eZHTTPTool $http
  * @param string $base
  * @param eZContentClassAttribute $classAttribute
  * @return bool
  */
 function fetchClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     if ($http->hasPostVariable($base . '_ezpage_default_layout_' . $classAttribute->attribute('id'))) {
         $defaultLayout = $http->postVariable($base . '_ezpage_default_layout_' . $classAttribute->attribute('id'));
         $classAttribute->setAttribute('data_text1', $defaultLayout);
     }
     return true;
 }
 /**
  * Fetches all variables inputed on content class level
  * return true if fetching of class attributes are successfull, false if not
  *
  * @param eZHTTPTool $http
  * @param string $base
  * @param eZContentClassAttribute $classAttribute
  * @return bool
  */
 function fetchClassAttributeHTTPInput( $http, $base, $classAttribute )
 {
     if ( $http->hasPostVariable( $base . '_ezpage_default_layout_' . $classAttribute->attribute( 'id' ) ) )
     {
         $defaultLayout = $http->postVariable( $base . '_ezpage_default_layout_' . $classAttribute->attribute( 'id' ) );
         $classAttribute->setAttribute( self::DEFAULT_ZONE_LAYOUT_FIELD, $defaultLayout );
     }
     return true;
 }
 /**
  * Stores the datatype data to the database which is related to the
  * class attribute. The $version parameter determines which version
  * is currently being stored, 0 is the real version while 1 is the
  * temporary version.
  *
  * @param eZContentClassAttribute $classAttribute
  * @param int $version
  */
 public function storeClassAttribute($classAttribute, $version)
 {
     $content = $classAttribute->content();
     // Make sure this can never slip into the database
     unset($content['db_options']);
     $xmlString = $this->classContentToXml($content);
     $classAttribute->setAttribute(self::CLASS_STORAGE_XML, $xmlString);
 }
 /**
  * Just before store the content , we convert
  *
  * @param eZContentClassAttribute $classAttribute
  * @param mixed                   $version
  */
 function preStoreClassAttribute($classAttribute, $version)
 {
     $classAttribute->setAttribute('data_text5', json_encode($classAttribute->attribute('content')));
     $version;
     // Just for phpcs
 }
 /**
  * Writes the class options in the class attribute's data fields.
  * 
  * @param eZContentClassAttribute $classAttribute Used as in/out parameter.
  *
  * @return void
  */
 public function setClassAttributeAttributes(eZContentClassAttribute $classAttribute)
 {
     $classAttribute->setAttribute(ymcDatatypeEnhancedSelectionType::FIELD_IS_NODE_PLACEMENT, (int) $this->isNodePlacement);
     $classAttribute->setAttribute(ymcDatatypeEnhancedSelectionType::FIELD_IS_MULTIPLE, (int) $this->isMultipleSelection);
     $classAttribute->setAttribute(ymcDatatypeEnhancedSelectionType::FIELD_DONT_ALLOW_REMOVAL, (int) $this->isRemovalForbidden);
     $classAttribute->setAttribute(ymcDatatypeEnhancedSelectionType::FIELD_DELIMITER, $this->delimiter);
     $classAttribute->setAttribute(ymcDatatypeEnhancedSelectionType::FIELD_OPTIONS, self::optionArrayToXml($this->options));
 }