本文整理匯總了PHP中ca_lists::itemIDsToIDNOs方法的典型用法代碼示例。如果您正苦於以下問題:PHP ca_lists::itemIDsToIDNOs方法的具體用法?PHP ca_lists::itemIDsToIDNOs怎麽用?PHP ca_lists::itemIDsToIDNOs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ca_lists
的用法示例。
在下文中一共展示了ca_lists::itemIDsToIDNOs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getEntry
/**
* Get a dictionary entry for a bundle. Entries are matched first on bundle name, and then filtered on any restrict_to_types
* and restrict_to_relationship_types settings in the $pa_settings parameter. This allows you to have different dictionary entries
* for the same bundle name subject to type restrictions set in the user interface. For example, if you have a ca_entities bundle (related
* entities) you can have different dictionary entries return when ca_entities is restricted to authors vs. publishers.
*
* @param string $ps_bundle_name The bundle name to find a dictionary entry for.
* @param array $pa_settings Bundle settings to use when matching definitions. The bundle settings restrict_to_types and restrict_to_relationship_types will be used, when present, to find type-restricted dictionary entries.
* @param array $pa_options Options include:
* noCache = Bypass cache (typically loaded using ca_metadata_dictionary_entries::preloadDefinitions()) and check entry directly. [Default=false]
*
* @return array An array with entry data. Keys are entry field names. The 'settings' key contains the label, definition text and any type restrictions. Returns null if no entry is defined.
*/
public static function getEntry($ps_bundle_name, $pa_settings = null, $pa_options = null)
{
if (caGetOption('noCache', $pa_options, false)) {
ca_metadata_dictionary_entries::preloadDefinitions(array($ps_bundle_name));
}
if (!is_array($va_types = caGetOption('restrict_to_types', $pa_settings, null)) && $va_types) {
$va_types = array($va_types);
}
if (!is_array($va_types)) {
$va_types = array();
}
if (sizeof($va_types = array_filter($va_types, 'strlen'))) {
$va_types = ca_lists::itemIDsToIDNOs($va_types);
}
if (!is_array($va_relationship_types = caGetOption('restrict_to_relationship_types', $pa_settings, null)) && $va_relationship_types) {
$va_relationship_types = array($va_relationship_types);
}
if (!is_array($va_relationship_types)) {
$va_relationship_types = array();
}
if (sizeof($va_relationship_types = array_filter($va_relationship_types, 'strlen'))) {
$va_relationship_types = ca_relationship_types::relationshipTypeIDsToTypeCodes($va_relationship_types);
}
if ($va_entry_list = ca_metadata_dictionary_entries::entryExists($ps_bundle_name)) {
$vn_entry_id = null;
if (sizeof($va_types) || sizeof($va_relationship_types)) {
foreach (array_keys($va_entry_list) as $vn_id) {
$va_entry = ca_metadata_dictionary_entries::$s_definition_cache[$vn_id];
if (sizeof($va_relationship_types)) {
if (is_array($va_entry_types = $va_entry['settings']['restrict_to_relationship_types'])) {
if (sizeof(array_intersect($va_relationship_types, $va_entry_types))) {
$vn_entry_id = $vn_id;
} else {
$vn_entry_id = null;
continue;
}
}
}
if (sizeof($va_types)) {
if (is_array($va_entry_types = $va_entry['settings']['restrict_to_types'])) {
if (sizeof(array_intersect($va_types, $va_entry_types))) {
$vn_entry_id = $vn_id;
} else {
$vn_entry_id = null;
continue;
}
}
}
if ($vn_entry_id) {
break;
}
}
}
if (!$vn_entry_id) {
$vn_entry_id = array_pop(array_keys($va_entry_list));
}
return ca_metadata_dictionary_entries::$s_definition_cache[$vn_entry_id];
}
return null;
}