本文整理汇总了PHP中eZContentObjectAttribute::setContent方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectAttribute::setContent方法的具体用法?PHP eZContentObjectAttribute::setContent怎么用?PHP eZContentObjectAttribute::setContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectAttribute
的用法示例。
在下文中一共展示了eZContentObjectAttribute::setContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromString
/**
* Store data from string format as created in {@link eZGmapLocationType::toString()}
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param string $string
*/
function fromString( $contentObjectAttribute, $string )
{
$data = $string !== '' && strpos( $string, '|#' ) !== false ? explode( '|#', $string ) : array( 0 );
if ( $data[0] != 0 )
{
$location = new eZGmapLocation( array(
'contentobject_attribute_id' => $contentObjectAttribute->attribute('id'),
'contentobject_version' => $contentObjectAttribute->attribute('version'),
'latitude' => $data[1],
'longitude' => $data[2],
'address' => $data[3]
));
$contentObjectAttribute->setContent( $location );
}
$contentObjectAttribute->setAttribute( 'data_int', $data[0] );
}
示例2: customObjectAttributeHTTPAction
//.........这里部分代码省略.........
if ($item->toBeRemoved()) {
$itemToBeRemoved = true;
$itemAdded = $item;
}
}
}
}
if ($itemAdded || $itemToBeRemoved) {
//if there is same item in history, or item to be removed (in history or valid), set the item in history to be modified
// if item is not to be removed, add to the block since it's not in block ,but in history or valid
if (!$itemToBeRemoved) {
$block->addItem($itemAdded);
}
$itemAdded->setXMLStorable(true);
$itemAdded->setAttribute('node_id', $nodeID);
$itemAdded->setAttribute('priority', $block->getItemCount());
$itemAdded->setAttribute('ts_publication', time());
$itemAdded->setAttribute('ts_visible', '0');
$itemAdded->setAttribute('ts_hidden', '0');
$itemAdded->setAttribute('action', 'modify');
} else {
if (!$itemValid) {
//if there is no same item in history and valid, also the item is not to be removed, add new
$item = $block->addItem(new eZPageBlockItem());
$item->setAttribute('object_id', $objectID);
$item->setAttribute('node_id', $nodeID);
$item->setAttribute('priority', $block->getItemCount());
$item->setAttribute('ts_publication', time());
$item->setAttribute('action', 'add');
}
}
}
}
$contentObjectAttribute->setContent($page);
$contentObjectAttribute->store();
}
}
break;
case 'new_item_browse':
$module = $parameters['module'];
$redirectionURI = $redirectionURI = $parameters['current-redirection-uri'];
$page = $contentObjectAttribute->content();
$zone = $page->getZone($params[1]);
$block = $zone->getBlock($params[2]);
$type = $block->attribute('type');
$blockINI = eZINI::instance('block.ini');
$classArray = false;
if ($blockINI->hasVariable($type, 'AllowedClasses')) {
$classArray = $blockINI->variable($type, 'AllowedClasses');
}
eZContentBrowse::browse(array('class_array' => $classArray, 'action_name' => 'AddNewBlockItem', 'browse_custom_action' => array('name' => 'CustomActionButton[' . $contentObjectAttribute->attribute('id') . '_new_item-' . $params[1] . '-' . $params[2] . ']', 'value' => $contentObjectAttribute->attribute('id')), 'from_page' => $redirectionURI, 'cancel_page' => $redirectionURI, 'persistent_data' => array('HasObjectInput' => 0)), $module);
break;
case 'new_source':
$page = $contentObjectAttribute->content();
$zone = $page->getZone($params[1]);
$block = $zone->getBlock($params[2]);
if ($http->hasPostVariable('SelectedNodeIDArray')) {
$selectedNodeIDArray = $http->postVariable('SelectedNodeIDArray');
$blockINI = eZINI::instance('block.ini');
$fetchParametersSelectionType = $blockINI->variable($block->attribute('type'), 'FetchParametersSelectionType');
$fetchParams = unserialize($block->attribute('fetch_params'));
if ($fetchParametersSelectionType['Source'] == 'single') {
$fetchParams['Source'] = $selectedNodeIDArray[0];
} else {
$fetchParams['Source'] = $selectedNodeIDArray;
}
示例3: insertSimpleString
/**
* @param eZContentObject $object
* @param eZContentObjectVersion $objectVersion
* @param string $objectLanguage
* @param eZContentObjectAttribute $objectAttribute
* @param string $string
* @param array $result
* @return bool
*/
function insertSimpleString($object, $objectVersion, $objectLanguage, $objectAttribute, $string, &$result)
{
$result = array("errors" => array(), "require_storage" => true);
$objectAttribute->setContent(trim($string));
$objectAttribute->setAttribute(self::OIB_FIELD, trim($string));
return true;
}
示例4: fromString
/**
* Converts string representation of content object attribute data to proper value
*
* @param eZContentObjectAttribute $objectAttribute
* @param $string
*/
public function fromString($objectAttribute, $string)
{
$content = unserialize($string);
if ($content === false) {
if (!empty($string) && is_string($string)) {
$content = array($string);
}
}
$objectAttribute->setContent($content);
}
示例5: unserializeContentObjectAttribute
/**
* Deserializes the content object attribute from provided DOM node
*
* @param eZPackage $package
* @param eZContentObjectAttribute $objectAttribute
* @param DOMNode $attributeNode
*/
function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
{
$idString = $attributeNode->getElementsByTagName('id-string')->item(0)->textContent;
$keywordString = $attributeNode->getElementsByTagName('keyword-string')->item(0)->textContent;
$parentString = $attributeNode->getElementsByTagName('parent-string')->item(0)->textContent;
$eztags = new eZTags();
$eztags->createFromStrings($idString, $keywordString, $parentString);
$objectAttribute->setContent($eztags);
}
示例6: initializeObjectAttribute
/**
* Init attribute ( also handles version to version copy, and attribute to attribute copy )
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param int|null $currentVersion
* @param eZContentObjectAttribute $originalContentObjectAttribute
*/
function initializeObjectAttribute($contentObjectAttribute, $currentVersion, $originalContentObjectAttribute)
{
if ($currentVersion !== false) {
$metas = $originalContentObjectAttribute->content();
/** @var FieldValue $metas */
if ($metas instanceof FieldValue) {
$contentObjectAttribute->setContent($metas);
$this->storeObjectAttribute($contentObjectAttribute);
return;
}
}
}