本文整理汇总了PHP中eZDataType::allowedTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDataType::allowedTypes方法的具体用法?PHP eZDataType::allowedTypes怎么用?PHP eZDataType::allowedTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDataType
的用法示例。
在下文中一共展示了eZDataType::allowedTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file
*/
require 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish datatype sql update\n\n" . "Script can be run as:\n" . "bin/php/ezimportdbafile.php --datatype=\n\n" . "Example: bin/php/ezimportdbafile.php --datatype=ezisbn", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[datatype:]", "", array('datatype' => "The name of the datatype where the database should be updated."));
$script->initialize();
$dataTypeName = $options['datatype'];
if ($dataTypeName === null) {
$cli->output("Error: The option --datatype is required. Add --help for more information.");
}
$allowedDatatypes = eZDataType::allowedTypes();
if ($dataTypeName !== null and in_array($dataTypeName, $allowedDatatypes)) {
// Inserting data from the dba-data files of the datatypes
eZDataType::loadAndRegisterAllTypes();
$registeredDataTypes = eZDataType::registeredDataTypes();
if (isset($registeredDataTypes[$dataTypeName])) {
$dataType = $registeredDataTypes[$dataTypeName];
if ($dataType->importDBDataFromDBAFile()) {
$cli->output("The database is updated for the datatype: " . $cli->style('emphasize') . $dataType->DataTypeString . $cli->style('emphasize-end') . "\n" . 'dba-data is imported from the file: ' . $cli->style('emphasize') . $dataType->getDBAFilePath() . $cli->style('emphasize-end'));
} else {
$activeExtensions = eZExtension::activeExtensions();
$errorString = "Failed importing datatype related data into database: \n" . ' datatype - ' . $dataType->DataTypeString . ", \n" . ' checked dba-data file - ' . $dataType->getDBAFilePath(false);
foreach ($activeExtensions as $activeExtension) {
$fileName = eZExtension::baseDirectory() . '/' . $activeExtension . '/datatypes/' . $dataType->DataTypeString . '/' . $dataType->getDBAFileName();
$errorString .= "\n" . str_repeat(' ', 23) . ' - ' . $fileName;
if (file_exists($fileName)) {
示例2: loadAndRegisterAllTypes
static function loadAndRegisterAllTypes()
{
$allowedTypes = eZDataType::allowedTypes();
foreach ($allowedTypes as $type) {
eZDataType::loadAndRegisterType($type);
}
}
示例3: addAttribute
protected function addAttribute($originalAttribute)
{
$class = $this->currentClass;
$localeAttributes = $class->fetchAttributes();
$placement = count($localeAttributes);
$allowedTypes = eZDataType::allowedTypes();
if (!$class->fetchAttributeByIdentifier($originalAttribute->Identifier) && in_array($originalAttribute->DataTypeString, $allowedTypes)) {
/** @var eZContentClassAttribute $localeAttribute */
$localeAttribute = eZContentClassAttribute::create($class->attribute('id'), $originalAttribute->DataTypeString, array('version' => eZContentClass::VERSION_STATUS_TEMPORARY, 'identifier' => $originalAttribute->Identifier, 'serialized_name_list' => $originalAttribute->SerializedNameList, 'serialized_description_list' => $originalAttribute->SerializedDescriptionList, 'category' => $originalAttribute->Category, 'serialized_data_text' => $originalAttribute->SerializedDataText, 'is_required' => $originalAttribute->IsRequired, 'is_searchable' => $originalAttribute->IsSearchable, 'is_information_collector' => $originalAttribute->IsInformationCollector, 'can_translate' => $originalAttribute->CanTranslate, 'placement' => ++$placement), $this->EditLanguage);
foreach ($this->fields as $localeIdentifier => $remoteProperty) {
$localeAttribute->setAttribute($localeIdentifier, $originalAttribute->{$remoteProperty});
}
$localeAttribute->store();
return $localeAttribute;
}
return false;
}