function init($plugin) { ctools_include('export'); $this->plugin = $plugin; // Get rid of the list parent. unset($this->plugin['menu']['items']['list callback']); }
/** * Implements Drupal\configuration\Config\Configuration::saveToActiveStore(). */ public function saveToActiveStore(ConfigIteratorSettings &$settings) { ctools_include('export'); $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier()); if ($object) { ctools_export_crud_delete($this->getComponent(), $object); } $data = $this->getData(); $data->export_type = NULL; // get title_pane key if configured. if (isset($data->conf['display']->title_pane)) { $title_pane = $data->conf['display']->title_pane; } $display = panels_save_display($data->conf['display']); // title_pane configuration workaround. if (isset($display->content[$title_pane])) { $pid = $display->content[$title_pane]->pid; $display->{$title_pane} = $pid; db_update('panels_display')->fields(array('title_pane' => $pid))->condition('did', $display->did)->execute(); } $data->conf['did'] = $data->conf['display']->did; unset($data->conf['display']); ctools_export_crud_save($this->getComponent(), $data); $settings->addInfo('imported', $this->getUniqueId()); }
public function access($op, $entity = NULL, $account = NULL) { if ($op !== 'create' && empty($entity)) { return FALSE; } // The administer permission is a blanket override. if (user_access('administer fieldable panels panes')) { return TRUE; } $bundle = is_string($entity) ? $entity : $entity->bundle; if ($op == 'create') { return user_access('create fieldable ' . $bundle); } if ($op == 'view') { ctools_include('context'); return ctools_access($entity->view_access, fieldable_panels_panes_get_base_context($entity)); } if ($op == 'update') { ctools_include('context'); return user_access('edit fieldable ' . $bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity)); } if ($op == 'delete') { ctools_include('context'); return user_access('delete fieldable ' . $bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity)); } return FALSE; }
protected function loadFromDb() { if (module_exists('ctools')) { ctools_include('export'); $result = ctools_export_load_object('ldap_authorization', 'names', array($this->consumerType)); // @todo, this is technically wrong, but I don't quite grok what we're doing in the non-ctools case - justintime $server_record = array_pop($result); // There's no ctools api call to get the reserved properties, so instead of hardcoding a list of them // here, we just grab everything. Basically, we sacrifice a few bytes of RAM for forward-compatibility. } else { $select = db_select('ldap_authorization', 'ldap_authorization'); $select->fields('ldap_authorization'); $select->condition('ldap_authorization.consumer_type', $this->consumerType); $server_record = $select->execute()->fetchObject(); } if (!$server_record) { $this->inDatabase = FALSE; return FALSE; } foreach ($this->field_to_properties_map() as $db_field_name => $property_name) { if (isset($server_record->{$db_field_name})) { if (in_array($db_field_name, $this->field_to_properties_serialized())) { $this->{$property_name} = unserialize($server_record->{$db_field_name}); } else { $this->{$property_name} = $server_record->{$db_field_name}; } } } $this->numericConsumerConfId = isset($server_record->numeric_consumer_conf_id) ? $server_record->numeric_consumer_conf_id : NULL; $this->server = ldap_servers_get_servers($this->sid, NULL, TRUE); return TRUE; }
protected function loadFromDb() { if (module_exists('ctools')) { ctools_include('export'); $result = ctools_export_load_object('ldap_authorization', 'names', array($this->consumerType)); // @todo, this is technically wrong, but I don't quite grok what we're doing in the non-ctools case - justintime $consumer_conf = array_pop($result); // There's no ctools api call to get the reserved properties, so instead of hardcoding a list of them // here, we just grab everything. Basically, we sacrifice a few bytes of RAM for forward-compatibility. } else { $select = db_select('ldap_authorization', 'ldap_authorization'); $select->fields('ldap_authorization'); $select->condition('ldap_authorization.consumer_type', $this->consumerType); $consumer_conf = $select->execute()->fetchObject(); } if (!$consumer_conf) { $this->inDatabase = FALSE; return; } $this->sid = $consumer_conf->sid; $this->consumerType = $consumer_conf->consumer_type; $this->numericConsumerConfId = isset($consumer_conf->numeric_consumer_conf_id) ? $consumer_conf->numeric_consumer_conf_id : NULL; $this->status = $consumer_conf->status ? 1 : 0; $this->onlyApplyToLdapAuthenticated = (bool) @$consumer_conf->only_ldap_authenticated; $this->useFirstAttrAsGroupId = (bool) @$consumer_conf->useFirstAttrAsGroupId; $this->searchAll = (bool) @$consumer_conf->searchAll; $this->mappings = $this->pipeListToArray($consumer_conf->mappings, FALSE); $this->useMappingsAsFilter = (bool) @$consumer_conf->use_filter; $this->synchToLdap = (bool) @$consumer_conf->synch_to_ldap; $this->synchOnLogon = (bool) @$consumer_conf->synch_on_logon; $this->regrantLdapProvisioned = (bool) @$consumer_conf->regrant_ldap_provisioned; $this->revokeLdapProvisioned = (bool) @$consumer_conf->revoke_ldap_provisioned; $this->createConsumers = (bool) @$consumer_conf->create_consumers; $this->server = ldap_servers_get_servers($this->sid, NULL, TRUE); }
function edit_form(&$form, &$form_state) { parent::edit_form($form, $form_state); ctools_include('stack-admin', 'panels_frame'); ctools_include('plugins', 'panels'); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels-frame.ui-stack', 'panels_frame'); // Set the cache identifier and immediately set an object cache. $form_state['cache_key'] = panels_frame_cache_key($form_state['item']->name); if (is_object($cache = panels_frame_cache_get('stack', $form_state['cache_key']))) { $form_state['item'] = $cache; } panels_frame_cache_set('stack', $form_state['cache_key'], $form_state['item']); $form['info']['#type'] = 'container'; $form['info']['#attributes']['class'][] = 'stack-admin-info'; $form['frames'] = panels_frame_stack_edit_form(array(), $form_state); $form['frames']['#type'] = 'container'; $form['frames']['#attributes']['class'][] = 'stack-admin-frames'; $form['buttons']['#type'] = 'container'; $form['buttons']['#attributes']['class'][] = 'stack-admin-buttons'; $form['info']['plugin'] = array('#type' => 'value', '#value' => 'stack'); }
public function save() { $op = $this->inDatabase ? 'edit' : 'insert'; $values = new stdClass(); // $this; $values->sid = $this->sid; $values->consumer_type = $this->consumerType; $values->consumer_module = $this->consumer->consumerModule; $values->status = $this->status ? 1 : 0; $values->only_ldap_authenticated = (int) $this->onlyApplyToLdapAuthenticated; $values->derive_from_dn = (int) $this->deriveFromDn; $values->derive_from_dn_attr = $this->deriveFromDnAttr; $values->derive_from_attr = (int) $this->deriveFromAttr; $values->derive_from_attr_attr = $this->arrayToLines($this->deriveFromAttrAttr); $values->derive_from_attr_use_first_attr = (int) $this->deriveFromAttrUseFirstAttr; $values->derive_from_attr_nested = (int) $this->deriveFromAttrNested; $values->derive_from_entry = (int) $this->deriveFromEntry; $values->derive_from_entry_search_all = (int) $this->deriveFromEntrySearchAll; $values->derive_from_entry_entries = $this->arrayToLines($this->deriveFromEntryEntries); $values->derive_from_entry_entries_attr = $this->deriveFromEntryEntriesAttr; $values->derive_from_entry_attr = $this->deriveFromEntryMembershipAttr; $values->derive_from_entry_user_ldap_attr = $this->deriveFromEntryAttrMatchingUserAttr; $values->derive_from_entry_use_first_attr = (int) $this->deriveFromEntryUseFirstAttr; $values->derive_from_entry_nested = (int) $this->deriveFromEntryNested; $values->mappings = $this->arrayToPipeList($this->mappings); $values->use_filter = (int) $this->useMappingsAsFilter; $values->synch_to_ldap = (int) $this->synchToLdap; $values->synch_on_logon = (int) $this->synchOnLogon; $values->revoke_ldap_provisioned = (int) $this->revokeLdapProvisioned; $values->create_consumers = (int) $this->createConsumers; $values->regrant_ldap_provisioned = (int) $this->regrantLdapProvisioned; if (module_exists('ctools')) { ctools_include('export'); // Populate our object with ctool's properties $object = ctools_export_crud_new('ldap_authorization'); foreach ($object as $property => $value) { if (!isset($values->{$property})) { $values->{$property} = $value; } } $result = ctools_export_crud_save('ldap_authorization', $values); } elseif ($op == 'edit') { $result = drupal_write_record('ldap_authorization', $values, 'consumer_type'); } else { // insert $result = drupal_write_record('ldap_authorization', $values); } if ($result) { $this->inDatabase = TRUE; } else { drupal_set_message(t('Failed to write LDAP Authorization to the database.')); } // revert mappings to array and remove temporary properties from ctools export $this->mappings = $this->pipeListToArray($values->mappings, TRUE); foreach (array('consumer_type', 'consumer_module', 'only_ldap_authenticated', 'derive_from_dn', 'derive_from_dn_attr', 'derive_from_attr', 'derive_from_attr_attr', 'derive_from_attr_use_first_attr', 'derive_from_attr_nested', 'derive_from_entry', 'derive_from_entry_entries', 'derive_from_entry_attr', 'derive_from_entry_search_all', 'derive_from_entry_use_first_attr', 'derive_from_entry_nested', 'use_filter', 'synch_to_ldap', 'synch_on_logon', 'revoke_ldap_provisioned', 'create_consumers', 'regrant_ldap_provisioned') as $prop_name) { unset($this->{$prop_name}); } }
/** * {@inheritdoc} */ public function getDefinition($plugin_id, $exception_on_invalid = TRUE) { ctools_include('plugins'); $definition = ctools_get_plugins($this->pluginOwner, $this->pluginType, $plugin_id); if (!$definition && $exception_on_invalid) { throw new PluginNotFoundException($plugin_id, sprintf('The "%s" plugin does not exist.', $plugin_id)); } return $definition; }
function _content_menu_filter_elements_by_domain($form, &$form_state) { $domain = $form_state['values']['domainselect']; ctools_include('ajax'); $_SESSION['content_menu_domain_filter'] = $domain; $commands[] = ctools_ajax_command_reload(); print ajax_render($commands); exit; }
/** * Page callback; Displays the subqueue add form. */ public function subqueue_add_page($js, $input, EntityQueue $queue) { global $user; drupal_set_title(t('Add subqueue to %queue', array('%queue' => $queue->label)), PASS_THROUGH); ctools_include('plugins'); $plugins = ctools_get_plugins('entityqueue', 'handler'); $subqueue = entityqueue_subqueue_create(array('queue' => $queue->name, 'module' => $plugins[$queue->handler]['module'], 'uid' => $user->uid)); return drupal_get_form('entityqueue_subqueue_edit_form', $queue, $subqueue); }
/** * Load information about Plugins by module and type * * This is a wrapper around ctools_get_plugins, with the benefit of loading the * relevant ctools include. We store the information locally in case its * required for reuse in this operation. * * @param string $module * The module providing the plugin * @param string $type * The type of plugin */ public function getPlugins($module, $type) { ctools_include('plugins'); $plugins = ctools_get_plugins($module, $type); if (!empty($plugins)) { if (!isset($this->plugins[$module])) { $this->plugins[$module] = array(); } $this->plugins[$module][$type] = $plugins; } }
/** * Include some ctools stuff required for drupal ajax to work properly. * @see ctools_export_ui::edit_form() */ public function edit_form(&$form, &$form_state) { // This is needed in order to get the ajax working in the ctools form. ctools_include('plugins'); ctools_include('export'); ctools_get_plugins('ctools', 'export_ui', 'entity_collection'); parent::edit_form($form, $form_state); // We need to define our own function, the one provided by ctools does not // work with the Drupal ajax API. $form['info']['name']['#machine_name']['exists'] = 'entity_collection_bundle_exists'; }
/** * @param $event_type * * @return array */ public function formatJson($event_type) { ctools_include('plugins'); $formatters = ctools_get_plugins('bat_event', 'bat_eventstyle'); foreach ($formatters as $formatter) { $class = ctools_plugin_get_class($formatter, 'handler'); $object_formatter = new $class($this->event); $event = $object_formatter->format($event_type); } return $event; }
function _content_menu_filter_elements_by_language($form, &$form_state) { $lang = $form_state['values']['langselect']; ctools_include('ajax'); $_SESSION['content_menu_lang_filter'] = $lang; if ($lang = '') { unset($_SESSION['content_menu_lang_filter']); } $commands[] = ctools_ajax_command_reload(); print ajax_render($commands); exit; }
public function save() { $op = $this->inDatabase ? 'edit' : 'insert'; $values = new stdClass(); // $this; $values->sid = $this->sid; $values->numeric_consumer_conf_id = $this->numericConsumerConfId; $values->consumer_type = $this->consumerType; $values->consumer_module = $this->consumer->consumerModule; $values->status = $this->status ? 1 : 0; $values->only_ldap_authenticated = (int) $this->onlyApplyToLdapAuthenticated; $values->use_first_attr_as_groupid = (int) $this->useFirstAttrAsGroupId; $values->mappings = serialize($this->mappings); $values->use_filter = (int) $this->useMappingsAsFilter; $values->synch_to_ldap = (int) $this->synchToLdap; $values->synch_on_logon = (int) $this->synchOnLogon; $values->revoke_ldap_provisioned = (int) $this->revokeLdapProvisioned; $values->create_consumers = (int) $this->createConsumers; $values->regrant_ldap_provisioned = (int) $this->regrantLdapProvisioned; if (module_exists('ctools')) { ctools_include('export'); // Populate our object with ctool's properties $object = ctools_export_crud_new('ldap_authorization'); foreach ($object as $property => $value) { if (!isset($values->{$property})) { $values->{$property} = $value; } } try { $values->export_type = NULL; $result = ctools_export_crud_save('ldap_authorization', $values); } catch (Exception $e) { // debug($e); Integrity constraint violation: 1062 Duplicate entry $values->export_type = EXPORT_IN_DATABASE; $result = ctools_export_crud_save('ldap_authorization', $values); } ctools_export_load_object_reset('ldap_authorization'); // ctools_export_crud_save doesn't invalidate cache } else { if ($op == 'edit') { $result = drupal_write_record('ldap_authorization', $values, 'consumer_type'); } else { // insert $result = drupal_write_record('ldap_authorization', $values); } if ($result) { $this->inDatabase = TRUE; } else { drupal_set_message(t('Failed to write LDAP Authorization to the database.')); } } }
private function getQuestion() { if (!$this->question) { ctools_include('object-cache'); $this->question = ctools_object_cache_get('ctools_ajax_sample', $this->getQuestionId()); } if (!$this->question) { module_load_include('class.php', 'chgk_db', 'classes/DbQuestionFactory'); $factory = new DbQuestionFactory(); $this->question = $factory->getQuestionFromTextId($this->getQuestionId()); } return $this->question; }
/** * Build configuration form. */ public function configForm(&$form_state) { $form = array(); ctools_include('plugins'); $form['authenticate_plugin'] = array('#type' => 'select', '#title' => t('Authentication plugin'), '#description' => t('Choose an authentication plugin'), '#options' => _mailhandler_build_options(mailhandler_get_plugins('mailhandler', 'authenticate')), '#default_value' => $this->config['authenticate_plugin'], '#required' => FALSE); $plugins = mailhandler_get_plugins('mailhandler', 'commands'); foreach ($plugins as $plugin_name => $plugin) { if ($class = mailhandler_plugin_load_class('mailhandler', $plugin_name, 'commands', 'handler')) { $class->configForm($form, $form_state, $this->config); } } return $form; }
function edit_form_rules(&$form, &$form_state) { // The 'access' UI passes everything via $form_state, unlike the 'context' UI. // The main difference is that one is about 3 years newer than the other. ctools_include('context'); ctools_include('context-access-admin'); $form_state['access'] = $form_state['item']->access; $form_state['contexts'] = ctools_context_load_contexts($form_state['item']); $form_state['module'] = 'ctools_export_ui'; $form_state['callback argument'] = $form_state['object']->plugin['name'] . ':' . $form_state['object']->edit_cache_get_key($form_state['item'], $form_state['form type']); $form_state['no buttons'] = TRUE; $form = array_merge($form, ctools_access_admin_form($form_state)); }
/** * Saves the configuration object into the DataStore. */ public function getDataToSave() { $filename = $this->filename; ctools_include('export'); $export = '$api = ' . $this->export($this->api_version) . ";\n\n"; $export .= '$data = ' . ctools_export_crud_export($this->table, $this->data) . "\n\n"; $export .= '$dependencies = ' . $this->export($this->dependencies) . ";\n\n"; $export .= '$optional = ' . $this->export($this->optional_configurations) . ";\n\n"; $export .= '$modules = ' . $this->export($this->required_modules) . ";"; $file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n"; $this->hash = sha1($file_contents); return $file_contents; }
/** * Implements Drupal\configuration\Config\Configuration::saveToActiveStore(). */ public function saveToActiveStore(ConfigIteratorSettings &$settings) { ctools_include('export'); $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier()); if ($object) { ctools_export_crud_delete($this->getComponent(), $object); } $data = $this->getData(); $data->export_type = NULL; $group = field_group_unpack($data); ctools_export_crud_save($this->getComponent(), $group); $settings->addInfo('imported', $this->getUniqueId()); }
public function save($op) { $op = $this->inDatabase ? 'edit' : 'insert'; if (module_exists('ctools')) { // add or edit with ctolls ctools_include('export'); $ctools_values = clone $this; foreach ($this->fields() as $field_id => $field) { $value = $this->{$field['property_name']}; if (isset($field['exportable']) && $field['exportable'] === FALSE) { // field not exportable unset($ctools_values->{$field['property_name']}); } elseif (isset($field['schema']) && $field['property_name'] != $field_id) { // field in property with different name $ctools_values->{$field_id} = $value; unset($ctools_values->{$field['property_name']}); } else { // do nothing. property is already in cloned objecat } } // Populate our object with ctool's properties. copying all properties for backward compatibility $object = ctools_export_crud_new('ldap_query'); foreach ($object as $property_name => $value) { if (!isset($ctools_values->{$property_name})) { $ctools_values->{$property_name} = $value; } } $result = ctools_export_crud_save('ldap_query', $ctools_values); ctools_export_load_object_reset('ldap_query'); // ctools_export_crud_save doesn't invalidate cache } else { $values = array(); foreach ($this->fields() as $field_id => $field) { if (isset($field['schema'])) { $values[$field_id] = $this->{$field['property_name']}; } } if ($op == 'edit') { // edit w/o ctools $result = drupal_write_record('ldap_query', $values, 'qid'); } else { // insert $result = drupal_write_record('ldap_query', $values); } } if ($result) { $this->inDatabase = TRUE; } else { drupal_set_message(t('Failed to write LDAP Query to the database.')); } }
public function save() { $op = $this->inDatabase ? 'edit' : 'insert'; $values = new stdClass(); // $this; $values->sid = $this->sid; $values->numeric_consumer_conf_id = $this->numericConsumerConfId; $values->consumer_type = $this->consumerType; $values->consumer_module = $this->consumer->consumerModule; $values->status = $this->status ? 1 : 0; $values->only_ldap_authenticated = (int) $this->onlyApplyToLdapAuthenticated; $values->useFirstAttrAsGroupId = (int) $this->useFirstAttrAsGroupId; $values->mappings = $this->arrayToPipeList($this->mappings); $values->use_filter = (int) $this->useMappingsAsFilter; $values->synch_to_ldap = (int) $this->synchToLdap; $values->synch_on_logon = (int) $this->synchOnLogon; $values->revoke_ldap_provisioned = (int) $this->revokeLdapProvisioned; $values->create_consumers = (int) $this->createConsumers; $values->regrant_ldap_provisioned = (int) $this->regrantLdapProvisioned; if (module_exists('ctools')) { ctools_include('export'); // Populate our object with ctool's properties $object = ctools_export_crud_new('ldap_authorization'); foreach ($object as $property => $value) { if (!isset($values->{$property})) { $values->{$property} = $value; } } $values->export_type = $this->numericConsumerConfId ? EXPORT_IN_DATABASE : NULL; $result = ctools_export_crud_save('ldap_authorization', $values); ctools_export_load_object_reset('ldap_authorization'); // ctools_export_crud_save doesn't invalidate cache } else { if ($op == 'edit') { $result = drupal_write_record('ldap_authorization', $values, 'consumer_type'); } else { // insert $result = drupal_write_record('ldap_authorization', $values); } if ($result) { $this->inDatabase = TRUE; } else { drupal_set_message(t('Failed to write LDAP Authorization to the database.')); } } // revert mappings to array and remove temporary properties from ctools export $this->mappings = $this->pipeListToArray($values->mappings, FALSE); foreach (array('consumer_type', 'consumer_module', 'only_ldap_authenticated', 'use_filter', 'synch_to_ldap', 'synch_on_logon', 'revoke_ldap_provisioned', 'create_consumers', 'regrant_ldap_provisioned') as $prop_name) { unset($this->{$prop_name}); } }
/** * Implements Drupal\configuration\Config\Configuration::saveToActiveStore(). */ public function saveToActiveStore(ConfigIteratorSettings &$settings) { ctools_include('export'); $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier()); if ($object) { ctools_export_crud_delete($this->getComponent(), $object); } $data = $this->getData(); $data->export_type = NULL; panels_save_display($data->conf['display']); $data->conf['did'] = $data->conf['display']->did; unset($data->conf['display']); ctools_export_crud_save($this->getComponent(), $data); $settings->addInfo('imported', $this->getUniqueId()); }
/** * Allow modules to provide their own caching mechanism for the display editor. * * @param string $argument * The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME * passed part: TASK_NAME:HANDLER_NAME * * @return stdClass|NULL * The cached display or NULL if the cache wasn't hit. */ function hook_panels_cache_get($argument) { ctools_include('common', 'panels'); list($handler, $item) = _panels_mini_panels_cache_get($argument); if (isset($item->mini_panels_display_cache)) { return $item->mini_panels_display_cache; } $cache = new stdClass(); $cache->display = $item->display; $cache->display->context = ctools_context_load_contexts($item); $cache->display->cache_key = 'panels_mini:' . $argument; $cache->content_types = panels_common_get_allowed_types('panels_mini', $cache->display->context); $cache->display_title = TRUE; // @TODO support locking. $cache->locked = FALSE; return $cache; }
protected function loadFromDb() { if (module_exists('ctools')) { ctools_include('export'); $result = ctools_export_load_object('ldap_authorization', 'names', array($this->consumerType)); // @todo, this is technically wrong, but I don't quite grok what we're doing in the non-ctools case - justintime $server_record = array_pop($result); // There's no ctools api call to get the reserved properties, so instead of hardcoding a list of them // here, we just grab everything. Basically, we sacrifice a few bytes of RAM for forward-compatibility. } else { $select = db_select('ldap_authorization', 'ldap_authorization'); $select->fields('ldap_authorization'); $select->condition('ldap_authorization.consumer_type', $this->consumerType); $server_record = $select->execute()->fetchObject(); } if (!$server_record) { $this->inDatabase = FALSE; return FALSE; } foreach ($this->field_to_properties_map() as $db_field_name => $property_name) { if (isset($server_record->{$db_field_name})) { if (in_array($db_field_name, $this->field_to_properties_serialized())) { $this->{$property_name} = unserialize($server_record->{$db_field_name}); } else { $this->{$property_name} = $server_record->{$db_field_name}; } } } $this->numericConsumerConfId = isset($server_record->numeric_consumer_conf_id) ? $server_record->numeric_consumer_conf_id : NULL; $this->server = ldap_servers_get_servers($this->sid, NULL, TRUE); return TRUE; // $this->sid = $consumer_conf->sid; // $this->consumerType = $consumer_conf->consumer_type; // $this->status = ($consumer_conf->status) ? 1 : 0; // $this->onlyApplyToLdapAuthenticated = (@$consumer_conf->only_ldap_authenticated); // $this->useFirstAttrAsGroupId = (@$consumer_conf->use_first_attr_as_groupid); // $this->mappings = unserialize($consumer_conf->mappings); // dpm($this->mappings); dpm($consumer_conf->mappings); // $this->useMappingsAsFilter = (@$consumer_conf->use_filter); // $this->synchToLdap = (@$consumer_conf->synch_to_ldap); // $this->synchOnLogon = (@$consumer_conf->synch_on_logon); // $this->regrantLdapProvisioned = (@$consumer_conf->regrant_ldap_provisioned); // $this->revokeLdapProvisioned = (@$consumer_conf->revoke_ldap_provisioned); // $this->createConsumers = (@$consumer_conf->create_consumers); }
/** * Overrides EntityInlineEntityFormController::entityForm(). * * Copied from fieldable_panels_panes_entity_edit_form(). */ public function entityForm($entity_form, &$form_state) { // Make the other form items dependent upon it. ctools_include('dependent'); ctools_add_js('dependent'); $entity = $entity_form['#entity']; $entity_type = 'fieldable_panels_pane'; list(, , $bundle) = entity_extract_ids($entity_type, $entity); // Map these properties for entity translations. $entity_form['#entity_type'] = array('#type' => 'value', '#value' => $entity->bundle); $form_state['fieldable_panels_pane'] = $entity_form['#entity']; $entity_form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $entity->title, '#weight' => -10); $entity_form['language'] = array('#type' => 'value', '#value' => $entity->language); $entity_form['link'] = array('#weight' => -10); $entity_form['link']['link'] = array('#title' => t('Make title a link'), '#type' => 'checkbox', '#default_value' => $entity->link, '#description' => t('Check here to make the title link to another page.'), '#id' => 'edit-link'); $entity_form['link']['path'] = array('#type' => 'textfield', '#title' => t('Path'), '#description' => t('The path for this link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')), '#dependency' => array('edit-link' => array(1)), '#default_value' => $entity->path); $entity_form['reusable'] = array('#weight' => 10); $entity_form['revision'] = array('#weight' => 11); if (empty($entity->fpid)) { $entity_form['revision']['#access'] = FALSE; } $entity_form['reusable']['reusable'] = array('#type' => 'checkbox', '#title' => t('Make this entity reusable'), '#default_value' => $entity->reusable, '#id' => 'edit-reusable'); $entity_form['reusable']['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#description' => t('The category this content will appear in the "Add content" modal. If left blank the category will be "Miscellaneous".'), '#dependency' => array('edit-reusable' => array(1)), '#default_value' => $entity->category); $entity_form['reusable']['admin_title'] = array('#type' => 'textfield', '#title' => t('Administrative title'), '#description' => t('The name this content will appear in the "Add content" modal.'), '#dependency' => array('edit-reusable' => array(1)), '#default_value' => $entity->admin_title); $entity_form['reusable']['admin_description'] = array('#type' => 'textarea', '#title' => t('Administrative description'), '#description' => t('A description of what this content is, does or is for, for administrative use.'), '#dependency' => array('edit-reusable' => array(1)), '#default_value' => $entity->admin_description); $entity_form['revision']['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => 1, '#id' => 'edit-revision'); if (!user_access('administer fieldable panels panes') || empty($entity->fpid) || $entity->vid != $entity->current_vid) { $form['revision']['revision']['#disabled'] = TRUE; $form['revision']['revision']['#value'] = TRUE; } $entity_form['revision']['log'] = array('#type' => 'textarea', '#title' => t('Log message'), '#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'), '#dependency' => array('edit-revision' => array(1)), '#default_value' => ''); $langcode = entity_language('fieldable_panels_pane', $entity); field_attach_form('fieldable_panels_pane', $entity, $entity_form, $form_state, $langcode); // _field_extra_fields_pre_render() doesn't execute properly, so manually // set the weights. $extra_fields = field_info_extra_fields($entity_type, $bundle, 'form'); foreach ($extra_fields as $name => $settings) { if (isset($entity_form[$name])) { $entity_form[$name]['#weight'] = $settings['weight']; } } return $entity_form; }
/** * Implements template_preprocess_page(). */ function oa_radix_preprocess_page(&$vars) { // Rework search_form to our liking. $vars['search_form'] = ''; if (module_exists('search') && user_access('search content')) { $search_box_form = drupal_get_form('search_form'); $search_box_form['basic']['keys']['#title'] = ''; $search_box_form['basic']['keys']['#attributes'] = array('placeholder' => 'Search'); $search_box_form['basic']['keys']['#attributes']['class'][] = 'search-query'; $search_box_form['basic']['submit']['#value'] = t('Search'); $search_box_form['#attributes']['class'][] = 'navbar-form'; $search_box_form['#attributes']['class'][] = 'pull-right'; $search_box = drupal_render($search_box_form); $vars['search_form'] = user_access('search content') ? $search_box : NULL; } // Add user_badge to header. $vars['user_badge'] = ''; if (module_exists('oa_dashboard')) { $user_badge = module_invoke('oa_dashboard', 'block_view', 'oa_user_badge'); $vars['user_badge'] = $user_badge['content']; } $toolbar = panels_mini_block_view('oa_toolbar_panel'); $vars['oa_toolbar_panel'] = isset($toolbar) ? $toolbar['content'] : ''; $footer = panels_mini_block_view('oa_footer_panel'); $vars['oa_footer_panel'] = isset($footer) ? $footer['content'] : ''; ctools_include('content'); $banner = ctools_content_render('oa_space_banner', '', array('banner_position' => 2)); if (!empty($banner->content)) { $vars['oa_banner'] = $banner->content; } $vars['oa_space_menu'] = ''; $space_id = oa_core_get_space_context(); if (variable_get('oa_space_menu_' . $space_id, TRUE)) { $space_menu = ctools_content_render('oa_space_menu', '', array(), array()); if (!empty($space_menu->content)) { $vars['oa_space_menu'] = $space_menu->content; } } }
public function access($op, $entity = NULL, $account = NULL) { if ($op !== 'create' && !$entity) { return FALSE; } // The administer permission is a blanket override. if (user_access('administer command buttons')) { return TRUE; } switch ($op) { case 'create': return user_access('create button ' . $entity); case 'view': return TRUE; case 'update': ctools_include('context'); return user_access('edit button ' . $entity->bundle); case 'delete': ctools_include('context'); return user_access('delete button ' . $entity->bundle); } return FALSE; }
/** * Implements BeanPlugin::form(). */ public function form($bean, $form, &$form_state) { $form = array(); // Show select box for the option set $optionsets = array(); ctools_include('export'); foreach (zm_template_load_all() as $name => $optionset) { $optionsets[$name] = check_plain($optionset->title); } $template_empty_des = ''; if (empty($optionsets)) { $template_empty_des = t(' You don\'t have any template, please <a href="@href">click here</a> to create one.', array('@href' => url('admin/config/content/zm_template/add'))); } $form['template'] = array('#title' => t('Template'), '#type' => 'select', '#options' => $optionsets, '#default_value' => $bean->template, '#description' => t("Chose template apply for slideshow.") . $template_empty_des); $image_styles = image_styles(); $image_style_options = array(); foreach ($image_styles as $stylename => $style) { $image_style_options[$stylename] = $style['label']; } $form['image_style_1'] = array('#type' => 'select', '#title' => t('Image Style 1'), '#options' => $image_style_options, '#default_value' => $bean->image_style_1, '#description' => t("Chose image style 1 apply for image field")); $form['image_style_2'] = array('#type' => 'select', '#title' => t('Image Style 2'), '#options' => $image_style_options, '#default_value' => $bean->image_style_2, '#description' => t("Chose image style 2 apply for image field")); return $form; }
/** * Prepare the list of panes to be rendered, accounting for visibility/access * settings and rendering order. * * This method represents the standard approach for determining the list of * panes to be rendered that is compatible with all parts of the Panels * architecture. It first applies visibility checks, then sorts panes into * their proper rendering order, and returns the result as an array. * * Inheriting classes should override this method if that renderer needs to * regularly make additions to the set of panes that will be rendered. * * @param array $panes * An associative array of pane data (stdClass objects), keyed on pane id. * @return array * An associative array of panes to be rendered, keyed on pane id and sorted * into proper rendering order. */ function prepare_panes($panes) { // Override parent::prepare_panes, so that any access-controls are not // applied to ESI panes. This ensures that panes are al ctools_include('content'); // Use local variables as writing to them is very slightly faster $first = $normal = $last = array(); // Prepare the list of panes to be rendered foreach ($panes as $pid => $pane) { if (empty($this->admin)) { // TODO remove in 7.x and ensure the upgrade path weeds out any stragglers; it's been long enough $pane->shown = !empty($pane->shown); // guarantee this field exists. // If this pane is not displayed, skip out and do the next one. // Do not handle user-access controls here for ESI panes (handle in the // ESI rendering). if (!$this->pane_should_be_rendered($pane)) { continue; } } $content_type = ctools_get_content_type($pane->type); // If this pane wants to render last, add it to the $last array. We allow // this because some panes need to be rendered after other panes, // primarily so they can do things like the leftovers of forms. if (!empty($content_type['render last'])) { $last[$pid] = $pane; } else { if (!empty($content_type['render first'])) { $first[$pid] = $pane; } else { $normal[$pid] = $pane; } } } $this->prepared['panes'] = $first + $normal + $last; return $this->prepared['panes']; }