本文整理匯總了PHP中eZContentClassAttribute::setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentClassAttribute::setAttribute方法的具體用法?PHP eZContentClassAttribute::setAttribute怎麽用?PHP eZContentClassAttribute::setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentClassAttribute
的用法示例。
在下文中一共展示了eZContentClassAttribute::setAttribute方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetchClassAttributeHTTPInput
/**
* 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);
}
}
示例2: unserializeContentClassAttribute
/**
* 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);
}
示例3: fetchClassAttributeHTTPInput
/**
* 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;
}
示例4: fetchClassAttributeHTTPInput
/**
* 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;
}
示例5: storeClassAttribute
/**
* 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);
}
示例6: preStoreClassAttribute
/**
* 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
}
示例7: setClassAttributeAttributes
/**
* 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));
}