protected function _initView($pa_options = null) { AssetLoadManager::register('bundleableEditor'); AssetLoadManager::register('sortableUI'); AssetLoadManager::register('bundleListEditorUI'); if ($vn_rc = parent::_initView()) { $t_screen = $this->view->getVar('t_subject'); $this->opn_ui_id = $t_screen->get('ui_id'); $t_ui = new ca_editor_uis($this->opn_ui_id); $va_screens = $t_ui->getScreens(null, array('showAll' => true)); if (is_array($va_screens)) { $o_result_context = new ResultContext($this->request, 'ca_editor_ui_screens', 'basic_search'); $o_result_context->setResultList(array_keys($va_screens)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); } } return $vn_rc; }
public function getAvailableSettings($pa_element_info = null) { global $_ca_attribute_settings, $g_request; $va_element_settings = $_ca_attribute_settings['ListAttributeValue']; /* * For the dependent field visibility feature we need to add a select-able list of all applicable * UI bundle placements here ... for each item in that list! */ if (Configuration::load()->get('enable_dependent_field_visibility') && is_array($pa_element_info) && isset($pa_element_info['list_id']) && (!$pa_element_info['settings']['render'] || in_array($pa_element_info['settings']['render'], array('select', 'radio_buttons', 'yes_no_checkboxes'))) && $g_request && $g_request instanceof RequestHTTP) { $va_options_for_settings = array(); $t_mde = new ca_metadata_elements($pa_element_info['element_id']); $va_restrictions = $t_mde->getTypeRestrictions(); $va_tables = array(); if (is_array($va_restrictions) && sizeof($va_restrictions)) { foreach ($va_restrictions as $va_restriction) { $va_tables[] = $va_restriction['table_num']; } } $t_ui = new ca_editor_uis(); foreach (array_unique($va_tables) as $vn_table_num) { // get UIs $va_ui_list = ca_editor_uis::getAvailableUIs($vn_table_num, $g_request); foreach ($va_ui_list as $vn_ui_id => $vs_ui_name) { $t_ui->load($vn_ui_id); // get screens foreach ($t_ui->getScreens() as $va_screen) { // get placements foreach ($t_ui->getScreenBundlePlacements($va_screen['screen_id']) as $va_placement) { $va_options_for_settings[$t_ui->get('editor_code') . '/' . $va_screen['idno'] . '/' . $va_placement['placement_code']] = $t_ui->get('editor_code') . '/' . $va_screen['idno'] . '/' . $va_placement['placement_code']; } } } } $t_list = new ca_lists(); foreach ($t_list->getItemsForList($pa_element_info['list_id']) as $va_items_by_locale) { foreach ($va_items_by_locale as $vn_locale_id => $va_item) { $va_element_settings['hideIfSelected_' . $va_item['idno']] = array('formatType' => FT_TEXT, 'displayType' => DT_SELECT, 'options' => $va_options_for_settings, 'takesLocale' => false, 'default' => '', 'width' => "400px", 'height' => 10, 'label' => _t('Hide bundles if "%1" is selected', $va_item['name_singular']), 'description' => _t('Select bundles from the list below')); } } } elseif (defined('__CollectiveAccess_Installer__') && Configuration::load()->get('enable_dependent_field_visibility')) { // when installing, UIs, screens and placements are not yet available when we process elementSets, so // we just add the hideIfSelected_* as available settings (without actual settings) so that the validation doesn't fail $t_list = new ca_lists(); foreach ($t_list->getItemsForList($pa_element_info['list_id']) as $va_items_by_locale) { foreach ($va_items_by_locale as $vn_locale_id => $va_item) { $va_element_settings['hideIfSelected_' . $va_item['idno']] = true; } } } return $va_element_settings; }