updated contrib modules
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -18,14 +18,15 @@ function views_ajax() {
|
||||
if (isset($_REQUEST['view_name']) && isset($_REQUEST['view_display_id'])) {
|
||||
$name = $_REQUEST['view_name'];
|
||||
$display_id = $_REQUEST['view_display_id'];
|
||||
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', $_REQUEST['view_args']) : array();
|
||||
$path = isset($_REQUEST['view_path']) ? rawurldecode($_REQUEST['view_path']) : NULL;
|
||||
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', htmlspecialchars_decode($_REQUEST['view_args'], ENT_QUOTES)) : array();
|
||||
$path = isset($_REQUEST['view_path']) ? htmlspecialchars_decode($_REQUEST['view_path'], ENT_QUOTES) : NULL;
|
||||
$dom_id = isset($_REQUEST['view_dom_id']) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $_REQUEST['view_dom_id']) : NULL;
|
||||
$pager_element = isset($_REQUEST['pager_element']) ? intval($_REQUEST['pager_element']) : NULL;
|
||||
|
||||
$commands = array();
|
||||
|
||||
// Remove all of this stuff from $_GET so it doesn't end up in pagers and tablesort URLs.
|
||||
// Remove all of this stuff from $_GET so it doesn't end up in pagers and
|
||||
// tablesort URLs.
|
||||
foreach (array('view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', 'ajax_html_ids', 'ajax_page_state') as $key) {
|
||||
if (isset($_GET[$key])) {
|
||||
unset($_GET[$key]);
|
||||
@@ -46,11 +47,11 @@ function views_ajax() {
|
||||
$_GET['q'] = $path;
|
||||
}
|
||||
|
||||
// If page parameter is in the $_POST exclude it from $_GET,
|
||||
// otherwise support views_ajax requests using $_GET.
|
||||
// If page parameter is in the $_POST exclude it from $_GET, otherwise
|
||||
// support views_ajax requests using $_GET.
|
||||
$exclude = isset($_POST['page']) ? array('page') : array();
|
||||
// Add all $_POST data to $_GET as many things,
|
||||
// such as tablesorts, exposed filters and paging assume $_GET.
|
||||
// Add all $_POST data to $_GET as many things, such as tablesorts,
|
||||
// exposed filters and paging assume $_GET.
|
||||
$_GET = $_POST + drupal_get_query_parameters($_GET, $exclude);
|
||||
|
||||
// Overwrite the destination.
|
||||
@@ -71,7 +72,8 @@ function views_ajax() {
|
||||
// Reuse the same DOM id so it matches that in Drupal.settings.
|
||||
$view->dom_id = $dom_id;
|
||||
|
||||
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, $view->preview($display_id, $args));
|
||||
// Always return HTML with the same DOM ID that was sent by the browser.
|
||||
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, preg_replace('/view-dom-id-[a-zA-Z0-9_-]+/', 'view-dom-id-' . $view->dom_id, $view->preview($display_id, $args), 1));
|
||||
}
|
||||
drupal_alter('views_ajax_data', $commands, $view);
|
||||
return array('#type' => 'ajax', '#commands' => $commands);
|
||||
@@ -81,14 +83,14 @@ function views_ajax() {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'viewsSetForm' command.
|
||||
*
|
||||
* @param $output
|
||||
* @param string $output
|
||||
* The form to display in the modal.
|
||||
* @param $title
|
||||
* @param string $title
|
||||
* The title.
|
||||
* @param $url
|
||||
* @param string $url
|
||||
* An optional URL.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_set_form($output, $title, $url = NULL) {
|
||||
@@ -106,7 +108,7 @@ function views_ajax_command_set_form($output, $title, $url = NULL) {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'viewsDismissForm' command.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_dismiss_form() {
|
||||
@@ -119,8 +121,8 @@ function views_ajax_command_dismiss_form() {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'viewsHilite' command.
|
||||
*
|
||||
* @param $selector
|
||||
* The selector to highlight
|
||||
* @param string $selector
|
||||
* The selector to highlight.
|
||||
*
|
||||
* @return
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
@@ -135,14 +137,14 @@ function views_ajax_command_hilite($selector) {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'addTab' command.
|
||||
*
|
||||
* @param $id
|
||||
* @param string $id
|
||||
* The DOM ID.
|
||||
* @param $title
|
||||
* @param string $title
|
||||
* The title.
|
||||
* @param $body
|
||||
* @param string $body
|
||||
* The body.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_add_tab($id, $title, $body) {
|
||||
@@ -158,7 +160,7 @@ function views_ajax_command_add_tab($id, $title, $body) {
|
||||
/**
|
||||
* Scroll to top of the current view.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_scroll_top($selector) {
|
||||
@@ -175,7 +177,7 @@ function views_ajax_command_scroll_top($selector) {
|
||||
* @param bool $changed
|
||||
* Whether of not the view has changed.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_show_buttons($changed) {
|
||||
@@ -189,7 +191,7 @@ function views_ajax_command_show_buttons($changed) {
|
||||
/**
|
||||
* Trigger the Views live preview.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_trigger_preview() {
|
||||
@@ -202,7 +204,7 @@ function views_ajax_command_trigger_preview() {
|
||||
/**
|
||||
* Replace the page title.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_replace_title($title) {
|
||||
@@ -216,6 +218,12 @@ function views_ajax_command_replace_title($title) {
|
||||
|
||||
/**
|
||||
* Return an AJAX error.
|
||||
*
|
||||
* @param string $message
|
||||
* The message to display.
|
||||
*
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_error($message) {
|
||||
$commands = array();
|
||||
@@ -225,6 +233,7 @@ function views_ajax_error($message) {
|
||||
|
||||
/**
|
||||
* Wrapper around drupal_build_form to handle some AJAX stuff automatically.
|
||||
*
|
||||
* This makes some assumptions about the client.
|
||||
*/
|
||||
function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
@@ -243,15 +252,15 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
$form = drupal_build_form($form_id, $form_state);
|
||||
$output = drupal_render($form);
|
||||
|
||||
// These forms have the title built in, so set the title here:
|
||||
// These forms have the title built in, so set the title here.
|
||||
if (empty($form_state['ajax']) && !empty($form_state['title'])) {
|
||||
drupal_set_title($form_state['title']);
|
||||
drupal_add_css(drupal_get_path('module', 'views_ui') . '/css/views-admin.css');
|
||||
}
|
||||
|
||||
if (!empty($form_state['ajax']) && (empty($form_state['executed']) || !empty($form_state['rerender']))) {
|
||||
// If the form didn't execute and we're using ajax, build up a
|
||||
// Ajax command list to execute.
|
||||
// If the form didn't execute and we're using ajax, build up a AJAX command
|
||||
// list to execute.
|
||||
$commands = array();
|
||||
|
||||
$display = '';
|
||||
@@ -279,7 +288,7 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
return $commands;
|
||||
}
|
||||
|
||||
// These forms have the title built in, so set the title here:
|
||||
// These forms have the title built in, so set the title here.
|
||||
if (empty($form_state['ajax']) && !empty($form_state['title'])) {
|
||||
drupal_set_title($form_state['title']);
|
||||
}
|
||||
@@ -289,13 +298,14 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
|
||||
|
||||
/**
|
||||
* Page callback for views user autocomplete
|
||||
* Page callback for views user autocomplete.
|
||||
*/
|
||||
function views_ajax_autocomplete_user($string = '') {
|
||||
// The user enters a comma-separated list of user name. We only autocomplete the last name.
|
||||
// The user enters a comma-separated list of user name. We only autocomplete
|
||||
// the last name.
|
||||
$array = drupal_explode_tags($string);
|
||||
|
||||
// Fetch last name
|
||||
// Fetch last name.
|
||||
$last_string = trim(array_pop($array));
|
||||
$matches = array();
|
||||
if ($last_string != '') {
|
||||
@@ -328,16 +338,16 @@ function views_ajax_autocomplete_user($string = '') {
|
||||
/**
|
||||
* Page callback for views taxonomy autocomplete.
|
||||
*
|
||||
* @param $vid
|
||||
* @param int $vid
|
||||
* The vocabulary id of the tags which should be returned.
|
||||
*
|
||||
* @param $tags_typed
|
||||
* @param string $tags_typed
|
||||
* The typed string of the user.
|
||||
*
|
||||
* @see taxonomy_autocomplete()
|
||||
*/
|
||||
function views_ajax_autocomplete_taxonomy($vid, $tags_typed = '') {
|
||||
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
|
||||
// The user enters a comma-separated list of tags. We only autocomplete the
|
||||
// last tag.
|
||||
$tags_typed = drupal_explode_tags($tags_typed);
|
||||
$tag_last = drupal_strtolower(array_pop($tags_typed));
|
||||
|
||||
|
@@ -16,8 +16,8 @@
|
||||
* Analyze a review and return the results.
|
||||
*
|
||||
* @return
|
||||
* An array of analyze results organized into arrays keyed by 'ok',
|
||||
* 'warning' and 'error'.
|
||||
* An array of analyze results organized into arrays keyed by 'ok', 'warning'
|
||||
* and 'error'.
|
||||
*/
|
||||
function views_analyze_view(&$view) {
|
||||
$view->init_display();
|
||||
@@ -79,12 +79,12 @@ function views_analyze_format_result($view, $messages) {
|
||||
* that may be broken unless the user knows what he or she is doing,
|
||||
* and 'error' for items that are definitely broken are much more useful.
|
||||
*
|
||||
* @param $messages
|
||||
* @param string $message
|
||||
* The message to report.
|
||||
* @param $type
|
||||
* @param string $type
|
||||
* The type of message. This should be "ok", "warning" or "error". Other
|
||||
* values can be used but how they are treated by the output routine
|
||||
* is undefined.
|
||||
* values can be used but how they are treated by the output routine is
|
||||
* undefined.
|
||||
*/
|
||||
function views_ui_analysis($message, $type = 'error') {
|
||||
return array('message' => $message, 'type' => $type);
|
||||
@@ -99,7 +99,7 @@ function views_ui_analysis($message, $type = 'error') {
|
||||
*/
|
||||
function views_ui_views_analyze($view) {
|
||||
$ret = array();
|
||||
// Check for something other than the default display:
|
||||
// Check for something other than the default display.
|
||||
if (count($view->display) < 2) {
|
||||
$ret[] = views_ui_analysis(t('This view has only a default display and therefore will not be placed anywhere on your site; perhaps you want to add a page or a block display.'), 'warning');
|
||||
}
|
||||
|
@@ -2,34 +2,36 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides the basic object definitions used by plugins and handlers.
|
||||
* Definition of views_object.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Basic definition for many views objects.
|
||||
* Provides the basic object definitions used by plugins and handlers.
|
||||
*/
|
||||
class views_object {
|
||||
|
||||
/**
|
||||
* Except for displays, options for the object will be held here.
|
||||
*/
|
||||
var $options = array();
|
||||
public $options = array();
|
||||
|
||||
/**
|
||||
* The top object of a view.
|
||||
*
|
||||
* @var view
|
||||
*/
|
||||
var $view = NULL;
|
||||
public $view = NULL;
|
||||
|
||||
/**
|
||||
* Handler's definition
|
||||
* Handler's definition.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $definition;
|
||||
public $definition;
|
||||
|
||||
/**
|
||||
* Information about options for all kinds of purposes will be held here.
|
||||
*
|
||||
* @code
|
||||
* 'option_name' => array(
|
||||
* - 'default' => default value,
|
||||
@@ -52,35 +54,69 @@ class views_object {
|
||||
* @see views_object::export_option_always()
|
||||
* @see views_object::unpack_translatable()
|
||||
*/
|
||||
function option_definition() { return array(); }
|
||||
public function option_definition() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Views handlers use a special construct function so that we can more
|
||||
* easily construct them with variable arguments.
|
||||
* Collect this handler's option definition and alter them, ready for use.
|
||||
*
|
||||
* @return array
|
||||
* Returns the options of this handler/plugin after allowing for alters.
|
||||
*
|
||||
* @see hook_views_plugin_option_definition_alter()
|
||||
* @see hook_views_handler_option_definition_alter()
|
||||
*/
|
||||
function construct() { $this->set_default_options(); }
|
||||
function altered_option_definition() {
|
||||
$definition = $this->option_definition();
|
||||
if (!empty($this->is_plugin)) {
|
||||
// Trigger hook_views_plugin_option_definition_alter().
|
||||
drupal_alter('views_plugin_option_definition', $definition, $this);
|
||||
}
|
||||
else {
|
||||
// Trigger hook_views_handler_option_definition_alter().
|
||||
drupal_alter('views_handler_option_definition', $definition, $this);
|
||||
}
|
||||
return $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default options on this object. Called by the constructor in a
|
||||
* complex chain to deal with backward compatibility.
|
||||
* Views handlers use a special construct function.
|
||||
*
|
||||
* Allows it to more easily construct them with variable arguments.
|
||||
*/
|
||||
public function construct() {
|
||||
$this->set_default_options();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default options on this object.
|
||||
*
|
||||
* Called by the constructor in a complex chain to deal with backward
|
||||
* compatibility.
|
||||
*
|
||||
* @deprecated since views2
|
||||
*/
|
||||
function options(&$options) { }
|
||||
public function options(&$options) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default options.
|
||||
* For backward compatibility, it sends the options array; this is a
|
||||
* feature that will likely disappear at some point.
|
||||
*
|
||||
* For backward compatibility, it sends the options array; this is a feature
|
||||
* that will likely disappear at some point.
|
||||
*/
|
||||
function set_default_options() {
|
||||
$this->_set_option_defaults($this->options, $this->option_definition());
|
||||
public function set_default_options() {
|
||||
$this->_set_option_defaults($this->options, $this->altered_option_definition());
|
||||
|
||||
// Retained for complex defaults plus backward compatibility.
|
||||
$this->options($this->options);
|
||||
}
|
||||
|
||||
function _set_option_defaults(&$storage, $options, $level = 0) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function _set_option_defaults(&$storage, $options, $level = 0) {
|
||||
foreach ($options as $option => $definition) {
|
||||
if (isset($definition['contains']) && is_array($definition['contains'])) {
|
||||
$storage[$option] = array();
|
||||
@@ -96,28 +132,28 @@ class views_object {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack options over our existing defaults, drilling down into arrays
|
||||
* so that defaults don't get totally blown away.
|
||||
* Unpack options over our existing defaults, drilling down into arrays so
|
||||
* that defaults don't get totally blown away.
|
||||
*/
|
||||
function unpack_options(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE, $localization_keys = array()) {
|
||||
public function unpack_options(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE, $localization_keys = array()) {
|
||||
if ($check && !is_array($options)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($definition)) {
|
||||
$definition = $this->option_definition();
|
||||
$definition = $this->altered_option_definition();
|
||||
}
|
||||
|
||||
if (!empty($this->view)) {
|
||||
// Ensure we have a localization plugin.
|
||||
$this->view->init_localization();
|
||||
|
||||
// Set up default localization keys. Handlers and such set this for us
|
||||
// Set up default localization keys. Handlers and such set this for us.
|
||||
if (empty($localization_keys) && isset($this->localization_keys)) {
|
||||
$localization_keys = $this->localization_keys;
|
||||
}
|
||||
// but plugins don't because there isn't a common init() these days.
|
||||
else if (!empty($this->is_plugin) && empty($localization_keys)) {
|
||||
elseif (!empty($this->is_plugin) && empty($localization_keys)) {
|
||||
if ($this->plugin_type != 'display') {
|
||||
$localization_keys = array($this->view->current_display);
|
||||
$localization_keys[] = $this->plugin_type;
|
||||
@@ -146,9 +182,9 @@ class views_object {
|
||||
|
||||
$this->unpack_options($storage[$key], $value, isset($definition[$key]['contains']) ? $definition[$key]['contains'] : array(), $all, FALSE, array_merge($localization_keys, array($key)));
|
||||
}
|
||||
// Don't localize strings during editing. When editing, we need to work with
|
||||
// the original data, not the translated version.
|
||||
else if (empty($this->view->editing) && !empty($definition[$key]['translatable']) && !empty($value) || !empty($definition['contains'][$key]['translatable']) && !empty($value)) {
|
||||
// Don't localize strings during editing. When editing, we need to work
|
||||
// with the original data, not the translated version.
|
||||
elseif (empty($this->view->editing) && !empty($definition[$key]['translatable']) && !empty($value) || !empty($definition['contains'][$key]['translatable']) && !empty($value)) {
|
||||
if (!empty($this->view) && $this->view->is_translatable()) {
|
||||
// Allow other modules to make changes to the string before it's
|
||||
// sent for translation.
|
||||
@@ -170,7 +206,7 @@ class views_object {
|
||||
$storage[$key] = t($value);
|
||||
}
|
||||
}
|
||||
else if ($all || !empty($definition[$key])) {
|
||||
elseif ($all || !empty($definition[$key])) {
|
||||
$storage[$key] = $value;
|
||||
}
|
||||
}
|
||||
@@ -179,14 +215,17 @@ class views_object {
|
||||
/**
|
||||
* Let the handler know what its full definition is.
|
||||
*/
|
||||
function set_definition($definition) {
|
||||
public function set_definition($definition) {
|
||||
$this->definition = $definition;
|
||||
if (isset($definition['field'])) {
|
||||
$this->real_field = $definition['field'];
|
||||
}
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
public function destroy() {
|
||||
if (isset($this->view)) {
|
||||
unset($this->view);
|
||||
}
|
||||
@@ -200,16 +239,22 @@ class views_object {
|
||||
}
|
||||
}
|
||||
|
||||
function export_options($indent, $prefix) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function export_options($indent, $prefix) {
|
||||
$output = '';
|
||||
foreach ($this->option_definition() as $option => $definition) {
|
||||
foreach ($this->altered_option_definition() as $option => $definition) {
|
||||
$output .= $this->export_option($indent, $prefix, $this->options, $option, $definition, array());
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function export_option($indent, $prefix, $storage, $option, $definition, $parents) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function export_option($indent, $prefix, $storage, $option, $definition, $parents) {
|
||||
// Do not export options for which we have no settings.
|
||||
if (!isset($storage[$option])) {
|
||||
return;
|
||||
@@ -220,7 +265,7 @@ class views_object {
|
||||
return;
|
||||
}
|
||||
|
||||
// Special handling for some items
|
||||
// Special handling for some items.
|
||||
if (method_exists($this, $definition['export'])) {
|
||||
return $this->{$definition['export']}($indent, $prefix, $storage, $option, $definition, $parents);
|
||||
}
|
||||
@@ -262,7 +307,7 @@ class views_object {
|
||||
/**
|
||||
* Always exports the option, regardless of the default value.
|
||||
*/
|
||||
function export_option_always($indent, $prefix, $storage, $option, $definition, $parents) {
|
||||
public function export_option_always($indent, $prefix, $storage, $option, $definition, $parents) {
|
||||
// If there is no default, the option will always be exported.
|
||||
unset($definition['default']);
|
||||
// Unset our export method to prevent recursion.
|
||||
@@ -273,8 +318,8 @@ class views_object {
|
||||
/**
|
||||
* Unpacks each handler to store translatable texts.
|
||||
*/
|
||||
function unpack_translatables(&$translatable, $parents = array()) {
|
||||
foreach ($this->option_definition() as $option => $definition) {
|
||||
public function unpack_translatables(&$translatable, $parents = array()) {
|
||||
foreach ($this->altered_option_definition() as $option => $definition) {
|
||||
$this->unpack_translatable($translatable, $this->options, $option, $definition, $parents, array());
|
||||
}
|
||||
}
|
||||
@@ -284,21 +329,21 @@ class views_object {
|
||||
*
|
||||
* This function run's through all suboptions recursive.
|
||||
*
|
||||
* @param $translatable
|
||||
* @param array $translatable
|
||||
* Stores all available translatable items.
|
||||
* @param $storage
|
||||
* @param $option
|
||||
* @param $definition
|
||||
* @param $parents
|
||||
* @param $keys
|
||||
* @param array $storage
|
||||
* @param string $option
|
||||
* @param string $definition
|
||||
* @param array $parents
|
||||
* @param array $keys
|
||||
*/
|
||||
function unpack_translatable(&$translatable, $storage, $option, $definition, $parents, $keys = array()) {
|
||||
public function unpack_translatable(&$translatable, $storage, $option, $definition, $parents, $keys = array()) {
|
||||
// Do not export options for which we have no settings.
|
||||
if (!isset($storage[$option])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Special handling for some items
|
||||
// Special handling for some items.
|
||||
if (isset($definition['unpack_translatable']) && method_exists($this, $definition['unpack_translatable'])) {
|
||||
return $this->{$definition['unpack_translatable']}($translatable, $storage, $option, $definition, $parents, $keys);
|
||||
}
|
||||
@@ -328,8 +373,8 @@ class views_object {
|
||||
if (is_array($value)) {
|
||||
$this->unpack_translatable($translatable, $options, $key, $definition, $parents, $translation_keys);
|
||||
}
|
||||
else if (!empty($definition[$key]['translatable']) && !empty($value)) {
|
||||
// Build source data and add to the array
|
||||
elseif (!empty($definition[$key]['translatable']) && !empty($value)) {
|
||||
// Build source data and add to the array.
|
||||
$format = NULL;
|
||||
if (isset($definition['format_key']) && isset($options[$definition['format_key']])) {
|
||||
$format = $options[$definition['format_key']];
|
||||
@@ -342,9 +387,9 @@ class views_object {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!empty($definition['translatable']) && !empty($options)) {
|
||||
elseif (!empty($definition['translatable']) && !empty($options)) {
|
||||
$value = $options;
|
||||
// Build source data and add to the array
|
||||
// Build source data and add to the array.
|
||||
$format = NULL;
|
||||
if (isset($definition['format_key']) && isset($storage[$definition['format_key']])) {
|
||||
$format = $storage[$definition['format_key']];
|
||||
@@ -356,4 +401,5 @@ class views_object {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,11 +6,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetch Views' data from the cache
|
||||
* Fetch Views' data from the cache.
|
||||
*
|
||||
* @param $move
|
||||
* Under certain circumstances it makes sense to not get the moved table, but the old one.
|
||||
* One example is views_get_handler.
|
||||
* @param string $table
|
||||
* @param bool $move
|
||||
* Under certain circumstances it makes sense to not get the moved table, but
|
||||
* the old one. One example is views_get_handler.
|
||||
* @param bool $reset
|
||||
*/
|
||||
function _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) {
|
||||
$cache = &drupal_static(__FUNCTION__ . '_cache');
|
||||
@@ -100,7 +102,8 @@ function _views_fetch_data_build() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Links tables having an 'entity type' specified to the respective generic entity-type tables.
|
||||
* Links tables having an 'entity type' specified to the respective generic
|
||||
* entity-type tables.
|
||||
*/
|
||||
function _views_data_process_entity_types(&$data) {
|
||||
foreach ($data as $table_name => $table_info) {
|
||||
@@ -151,7 +154,7 @@ function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE)
|
||||
return $cache;
|
||||
}
|
||||
elseif (!$plugin) {
|
||||
// Not in the if above so the else below won't run
|
||||
// Not in the if above so the else below won't run.
|
||||
if (isset($cache[$type])) {
|
||||
return $cache[$type];
|
||||
}
|
||||
@@ -169,12 +172,13 @@ function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE)
|
||||
*
|
||||
* This is just a convenience wrapper around cache_set().
|
||||
*
|
||||
* @param $cid
|
||||
* @param string $cid
|
||||
* The cache ID of the data to store.
|
||||
* @param $data
|
||||
* The data to store in the cache. Complex data types will be automatically serialized before insertion.
|
||||
* Strings will be stored as plain text and not serialized.
|
||||
* @param $use_language
|
||||
* @param mixed $data
|
||||
* The data to store in the cache. Complex data types will be automatically
|
||||
* serialized before insertion. Strings will be stored as plain text and not
|
||||
* serialized.
|
||||
* @param bool $use_language
|
||||
* If TRUE, the data will be cached specific to the currently active language.
|
||||
*/
|
||||
function views_cache_set($cid, $data, $use_language = FALSE) {
|
||||
@@ -198,7 +202,8 @@ function views_cache_set($cid, $data, $use_language = FALSE) {
|
||||
* @param int $cid
|
||||
* The cache ID of the data to retrieve.
|
||||
* @param bool $use_language
|
||||
* If TRUE, the data will be requested specific to the currently active language.
|
||||
* If TRUE, the data will be requested specific to the currently active
|
||||
* language.
|
||||
*
|
||||
* @return stdClass|bool
|
||||
* The cache or FALSE on failure.
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
* Built in plugins for Views output handling.
|
||||
*/
|
||||
|
||||
// @todo: Remove this once update.php can use the registry
|
||||
// @todo Remove this once update.php can use the registry.
|
||||
views_include('base');
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ function views_views_plugins() {
|
||||
'title' => t('Empty display extender'),
|
||||
'help' => t('Default settings for this view.'),
|
||||
'handler' => 'views_plugin_display_extender',
|
||||
// You can force the plugin to be enabled
|
||||
// You can force the plugin to be enabled.
|
||||
'enabled' => FALSE,
|
||||
'no ui' => TRUE,
|
||||
),
|
||||
@@ -160,7 +160,8 @@ function views_views_plugins() {
|
||||
'help' => t('Displays the default summary as a list.'),
|
||||
'handler' => 'views_plugin_style_summary',
|
||||
'theme' => 'views_view_summary',
|
||||
'type' => 'summary', // only shows up as a summary style
|
||||
'type' => 'summary',
|
||||
// only shows up as a summary style.
|
||||
'uses options' => TRUE,
|
||||
'help topic' => 'style-summary',
|
||||
),
|
||||
@@ -169,7 +170,8 @@ function views_views_plugins() {
|
||||
'help' => t('Displays the summary unformatted, with option for one after another or inline.'),
|
||||
'handler' => 'views_plugin_style_summary_unformatted',
|
||||
'theme' => 'views_view_summary_unformatted',
|
||||
'type' => 'summary', // only shows up as a summary style
|
||||
'type' => 'summary',
|
||||
// only shows up as a summary style.
|
||||
'uses options' => TRUE,
|
||||
'help topic' => 'style-summary-unformatted',
|
||||
),
|
||||
@@ -266,7 +268,7 @@ function views_views_plugins() {
|
||||
'views_query' => array(
|
||||
'title' => t('SQL Query'),
|
||||
'help' => t('Query will be generated and run using the Drupal database API.'),
|
||||
'handler' => 'views_plugin_query_default'
|
||||
'handler' => 'views_plugin_query_default',
|
||||
),
|
||||
),
|
||||
'cache' => array(
|
||||
@@ -356,7 +358,7 @@ function views_views_plugins() {
|
||||
'handler' => 'views_plugin_localization',
|
||||
'parent' => '',
|
||||
),
|
||||
'none' => array(
|
||||
'none' => array(
|
||||
'title' => t('None'),
|
||||
'help' => t('Do not pass admin strings for translation.'),
|
||||
'handler' => 'views_plugin_localization_none',
|
||||
@@ -381,7 +383,8 @@ function views_views_plugins() {
|
||||
'help' => t('Puts all of the results into a select box and allows the user to go to a different page based upon the results.'),
|
||||
'handler' => 'views_plugin_style_summary_jump_menu',
|
||||
'theme' => 'views_view_summary_jump_menu',
|
||||
'type' => 'summary', // only shows up as a summary style
|
||||
'type' => 'summary',
|
||||
// only shows up as a summary style.
|
||||
'uses options' => TRUE,
|
||||
'help topic' => 'style-summary-jump-menu',
|
||||
);
|
||||
@@ -417,7 +420,7 @@ function views_discover_plugins() {
|
||||
}
|
||||
|
||||
$module_dir = isset($result['module']) ? $result['module'] : $module;
|
||||
// Setup automatic path/file finding for theme registration
|
||||
// Setup automatic path/file finding for theme registration.
|
||||
if ($module_dir == 'views') {
|
||||
$theme_path = drupal_get_path('module', $module_dir) . '/theme';
|
||||
$theme_file = 'theme.inc';
|
||||
@@ -452,7 +455,7 @@ function views_discover_plugins() {
|
||||
// Set the internal name to be able to read it out later.
|
||||
$def['name'] = $plugin;
|
||||
|
||||
// merge the new data in
|
||||
// merge the new data in.
|
||||
$cache[$type][$plugin] = $def;
|
||||
}
|
||||
}
|
||||
@@ -467,29 +470,30 @@ function views_discover_plugins() {
|
||||
* Abstract base class to provide interface common to all plugins.
|
||||
*/
|
||||
class views_plugin extends views_object {
|
||||
|
||||
/**
|
||||
* The top object of a view.
|
||||
*
|
||||
* @var view
|
||||
*/
|
||||
var $view = NULL;
|
||||
public $view = NULL;
|
||||
|
||||
/**
|
||||
* The current used views display.
|
||||
*
|
||||
* @var views_display
|
||||
*/
|
||||
var $display = NULL;
|
||||
public $display = NULL;
|
||||
|
||||
/**
|
||||
* The plugin type of this plugin, for example style or query.
|
||||
*/
|
||||
var $plugin_type = NULL;
|
||||
public $plugin_type = NULL;
|
||||
|
||||
/**
|
||||
* The plugin name of this plugin, for example table or full.
|
||||
*/
|
||||
var $plugin_name = NULL;
|
||||
public $plugin_name = NULL;
|
||||
|
||||
/**
|
||||
* Init will be called after construct, when the plugin is attached to a
|
||||
@@ -499,7 +503,7 @@ class views_plugin extends views_object {
|
||||
/**
|
||||
* Provide a form to edit options for this plugin.
|
||||
*/
|
||||
function options_form(&$form, &$form_state) {
|
||||
public function options_form(&$form, &$form_state) {
|
||||
// Some form elements belong in a fieldset for presentation, but can't
|
||||
// be moved into one because of the form_state['values'] hierarchy. Those
|
||||
// elements can add a #fieldset => 'fieldset_name' property, and they'll
|
||||
@@ -510,22 +514,25 @@ class views_plugin extends views_object {
|
||||
/**
|
||||
* Validate the options form.
|
||||
*/
|
||||
function options_validate(&$form, &$form_state) { }
|
||||
public function options_validate(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle any special handling on the validate form.
|
||||
*/
|
||||
function options_submit(&$form, &$form_state) { }
|
||||
public function options_submit(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add anything to the query that we might need to.
|
||||
*/
|
||||
function query() { }
|
||||
public function query() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a full list of possible theme templates used by this style.
|
||||
*/
|
||||
function theme_functions() {
|
||||
public function theme_functions() {
|
||||
if (empty($this->definition['theme'])) {
|
||||
$this->definition['theme'] = 'views_view';
|
||||
}
|
||||
@@ -533,9 +540,9 @@ class views_plugin extends views_object {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a list of additional theme functions for the theme information page
|
||||
* Provide a list of additional theme functions for the theme info page.
|
||||
*/
|
||||
function additional_theme_functions() {
|
||||
public function additional_theme_functions() {
|
||||
$funcs = array();
|
||||
if (!empty($this->definition['additional themes'])) {
|
||||
foreach ($this->definition['additional themes'] as $theme => $type) {
|
||||
@@ -548,16 +555,18 @@ class views_plugin extends views_object {
|
||||
/**
|
||||
* Validate that the plugin is correct and can be saved.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of error strings to tell the user what is wrong with this
|
||||
* plugin.
|
||||
*/
|
||||
function validate() { return array(); }
|
||||
public function validate() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the summary of the settings in the display.
|
||||
*/
|
||||
function summary_title() {
|
||||
public function summary_title() {
|
||||
return t('Settings');
|
||||
}
|
||||
/**
|
||||
@@ -565,12 +574,13 @@ class views_plugin extends views_object {
|
||||
*
|
||||
* This appears on the ui beside each plugin and beside the settings link.
|
||||
*/
|
||||
function plugin_title() {
|
||||
public function plugin_title() {
|
||||
if (isset($this->definition['short title'])) {
|
||||
return check_plain($this->definition['short title']);
|
||||
}
|
||||
return check_plain($this->definition['title']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user