ran security updates on contrib modules
ctools, video_embed_field, migrate, views_bulk_operations
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'title' => t('Comment created date'),
|
||||
'icon' => 'icon_comment.png',
|
||||
'description' => t('The date the referenced comment was created.'),
|
||||
'required context' => new ctools_context_required(t('Comment'), 'entity:comment'),
|
||||
'category' => t('Comment'),
|
||||
'defaults' => array(
|
||||
'format' => 'small',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_comment_created_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get a shortcut to the comment.
|
||||
$comment = $context->data;
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'comment_created';
|
||||
$block->title = t('Created date');
|
||||
$block->content = format_date($comment->created, $conf['format']);
|
||||
$block->delta = $comment->cid;
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_comment_created_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
$date_types = array();
|
||||
|
||||
foreach (system_get_date_types() as $date_type => $definition) {
|
||||
$date_types[$date_type] = format_date(REQUEST_TIME, $date_type);
|
||||
}
|
||||
$form['format'] = array(
|
||||
'#title' => t('Date format'),
|
||||
'#type' => 'select',
|
||||
'#options' => $date_types,
|
||||
'#default_value' => $conf['format'],
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the custom type settings form.
|
||||
*/
|
||||
function ctools_comment_created_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_comment_created_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" created date', array('@s' => $context->identifier));
|
||||
}
|
@@ -34,6 +34,14 @@ function ctools_entity_field_content_type_content_types() {
|
||||
return $types;
|
||||
}
|
||||
|
||||
$cache_key = 'ctools_entity_field_content_type_content_types';
|
||||
if ($cache = cache_get($cache_key)) {
|
||||
$types = $cache->data;
|
||||
if (!empty($types)) {
|
||||
return $types;
|
||||
}
|
||||
}
|
||||
|
||||
// This will hold all the individual field content types.
|
||||
$context_types = array();
|
||||
$entities = entity_get_info();
|
||||
@@ -82,6 +90,8 @@ function ctools_entity_field_content_type_content_types() {
|
||||
unset($context_types[$key]['types']);
|
||||
}
|
||||
|
||||
cache_set($cache_key, $types);
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
|
@@ -57,6 +57,26 @@ function ctools_entity_form_field_content_type_content_types() {
|
||||
}
|
||||
}
|
||||
|
||||
if (module_exists('field_group')) {
|
||||
foreach ($entities as $entity_type => $entity) {
|
||||
foreach ($entity['bundles'] as $type => $bundle) {
|
||||
if ($group_info = field_group_info_groups($entity_type, $type, "form")) {
|
||||
foreach ($group_info as $group_name => $group) {
|
||||
if (!isset($types[$entity_type . ':' . $group_name])) {
|
||||
$types[$entity_type . ':' . $group_name] = array(
|
||||
'category' => t('Form'),
|
||||
'icon' => 'icon_field.png',
|
||||
'title' => t('Group form: @widget_label', array('@widget_label' => $group->label)),
|
||||
'description' => t('Field group on the referenced entity.'),
|
||||
);
|
||||
}
|
||||
$content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create the required context for each field related to the bundle types.
|
||||
foreach ($types as $key => $field_content_type) {
|
||||
list($entity_type, $field_name) = explode(':', $key, 2);
|
||||
@@ -85,16 +105,38 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar
|
||||
$ids = entity_extract_ids($entity_type, $entity);
|
||||
$field = field_info_instance($entity_type, $field_name, $ids[2]);
|
||||
|
||||
// Do not render if the entity type does not have this field.
|
||||
if (empty($field)) {
|
||||
// Check for field groups.
|
||||
if (empty($field) && module_exists('field_group')) {
|
||||
$groups = field_group_info_groups($entity_type, $entity->type, "form");
|
||||
$group = !empty($groups[$field_name]) ? $groups[$field_name] : NULL;
|
||||
}
|
||||
|
||||
// Do not render if the entity type does not have this field or group.
|
||||
if (empty($field) && empty($group)) {
|
||||
return;
|
||||
}
|
||||
$block = new stdClass();
|
||||
|
||||
$block = new stdClass();
|
||||
if (isset($context->form)) {
|
||||
$block->content = array();
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
if (!empty($field)) {
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
}
|
||||
else {
|
||||
// Pre-render the form to populate field groups.
|
||||
if (isset($context->form['#pre_render'])) {
|
||||
foreach ($context->form['#pre_render'] as $function) {
|
||||
if (function_exists($function)) {
|
||||
$context->form = $function($context->form);
|
||||
}
|
||||
}
|
||||
unset($context->form['#pre_render']);
|
||||
}
|
||||
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$block->content = t('Entity info.');
|
||||
|
@@ -77,20 +77,3 @@ function ctools_node_comment_form_content_type_edit_form_submit($form, &$form_st
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the comment form to get a little more control over it.
|
||||
*/
|
||||
function ctools_form_comment_form_alter(&$form, &$form_state) {
|
||||
if (!empty($form_state['ctools comment alter'])) {
|
||||
// Force the form to post back to wherever we are.
|
||||
$form['#action'] = url($_GET['q'], array('fragment' => 'comment-form'));
|
||||
if (empty($form['#submit'])) {
|
||||
$form['#submit'] = array('comment_form_submit');
|
||||
}
|
||||
$form['#submit'][] = 'ctools_node_comment_form_submit';
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_node_comment_form_submit(&$form, &$form_state) {
|
||||
$form_state['redirect'][0] = $_GET['q'];
|
||||
}
|
||||
|
@@ -29,6 +29,9 @@ $plugin = array(
|
||||
* Outputs the page title of the current page.
|
||||
*/
|
||||
function ctools_page_title_content_type_render($subtype, $conf, $panel_args) {
|
||||
if (!drupal_get_title()) {
|
||||
return;
|
||||
}
|
||||
// TODO: This should have a setting or something for the markup.
|
||||
if (empty($conf['markup'])) {
|
||||
$conf['markup'] = 'h1';
|
||||
|
@@ -18,8 +18,8 @@ function ctools_term_description_content_type_render($subtype, $conf, $panel_arg
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_type';
|
||||
|
||||
$block->title = $term->name;
|
||||
if ($term) {
|
||||
if (!empty($term)) {
|
||||
$block->title = $term->name;
|
||||
$block->content = check_markup($term->description, $term->format, '', TRUE);
|
||||
$block->delta = $term->tid;
|
||||
|
||||
@@ -33,6 +33,7 @@ function ctools_term_description_content_type_render($subtype, $conf, $panel_arg
|
||||
}
|
||||
}
|
||||
else {
|
||||
$block->title = '';
|
||||
$block->content = t('Term description goes here.');
|
||||
$block->delta = 'unknown';
|
||||
}
|
||||
|
@@ -43,7 +43,9 @@ function ctools_context_create_user($empty, $data = NULL, $conf = FALSE) {
|
||||
if ($data['type'] == 'current') {
|
||||
global $user;
|
||||
$data = user_load($user->uid);
|
||||
$data->logged_in_user = TRUE;
|
||||
if (user_is_logged_in()) {
|
||||
$data->logged_in_user = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data = user_load($data['uid']);
|
||||
|
@@ -34,15 +34,15 @@ function ctools_context_create_user_edit_form($empty, $user = NULL, $conf = FALS
|
||||
$category = !empty($conf['category']) ? $conf['category'] : FALSE;
|
||||
unset($conf['category']);
|
||||
|
||||
// If no category was specified, use the default 'account'.
|
||||
if (!$category) {
|
||||
$category = 'account';
|
||||
}
|
||||
// Return previously created contexts, per category.
|
||||
static $created = array();
|
||||
if (!empty($created[$category])) {
|
||||
return $created[$category];
|
||||
}
|
||||
// If no category was specified, use the default 'account'.
|
||||
if (!$category) {
|
||||
$category = 'account';
|
||||
}
|
||||
|
||||
$context = new ctools_context(array('form', 'user_edit', 'user_form', 'user_edit_form', 'user', 'entity:user'));
|
||||
// Store this context for later.
|
||||
|
@@ -724,7 +724,13 @@ class ctools_export_ui {
|
||||
// Export the handler, which is a fantastic way to clean database IDs out of it.
|
||||
$export = ctools_export_crud_export($this->plugin['schema'], $original);
|
||||
$item = ctools_export_crud_import($this->plugin['schema'], $export);
|
||||
$item->{$this->plugin['export']['key']} = 'clone_of_' . $item->{$this->plugin['export']['key']};
|
||||
|
||||
if (!empty($input[$this->plugin['export']['key']])) {
|
||||
$item->{$this->plugin['export']['key']} = $input[$this->plugin['export']['key']];
|
||||
}
|
||||
else {
|
||||
$item->{$this->plugin['export']['key']} = 'clone_of_' . $item->{$this->plugin['export']['key']};
|
||||
}
|
||||
}
|
||||
|
||||
// Tabs and breadcrumb disappearing, this helps alleviate through cheating.
|
||||
|
@@ -185,7 +185,7 @@ function ctools_entity_from_field_context($context, $conf) {
|
||||
$loaded_to_entity = array_shift($loaded_to_entity);
|
||||
|
||||
// Pass current user account and entity type to access callback.
|
||||
if (function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity, $account, $to_entity)) {
|
||||
if (isset($to_entity_info['access callback']) && function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity)) {
|
||||
return ctools_context_create_empty('entity:' . $to_entity, NULL);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user