first import

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-08 11:40:19 +02:00
commit 1bc61b12ad
8435 changed files with 1582817 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
/**
* @file
* Definition of views_test_plugin_access_test_dynamic.
*/
/**
* Tests a dynamic access plugin.
*/
class views_test_plugin_access_test_dynamic extends views_plugin_access {
function option_definition() {
$options = parent::option_definition();
$options['access'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
function access($account) {
return !empty($this->options['access']) && isset($this->view->args[0]) && $this->view->args[0] == variable_get('test_dynamic_access_argument1', NULL) && isset($this->view->args[1]) && $this->view->args[1] == variable_get('test_dynamic_access_argument2', NULL);
}
function get_access_callback() {
return array('views_test_test_dynamic_access_callback', array(!empty($options['access']), 1, 2));
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* @file
* Definition of views_test_plugin_access_test_static.
*/
/**
* Tests a static access plugin.
*/
class views_test_plugin_access_test_static extends views_plugin_access {
function option_definition() {
$options = parent::option_definition();
$options['access'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
function access($account) {
return !empty($this->options['access']);
}
function get_access_callback() {
return array('views_test_test_static_access_callback', array(!empty($options['access'])));
}
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* @file
* Definition of views_test_plugin_style_test_mapping.
*/
/**
* Provides a test mapping style plugin.
*/
class views_test_plugin_style_test_mapping extends views_plugin_style_mapping {
/**
* Overrides views_plugin_style_mapping::define_mapping().
*/
protected function define_mapping() {
return array(
'title_field' => array(
'#title' => t('Title field'),
'#description' => t('Choose the field with the custom title.'),
'#toggle' => TRUE,
'#required' => TRUE,
),
'name_field' => array(
'#title' => t('Name field'),
'#description' => t('Choose the field with the custom name.'),
),
'numeric_field' => array(
'#title' => t('Numeric field'),
'#description' => t('Select one or more numeric fields.'),
'#multiple' => TRUE,
'#toggle' => TRUE,
'#filter' => 'filter_numeric_fields',
'#required' => TRUE,
),
);
}
/**
* Restricts the allowed fields to only numeric fields.
*
* @param array $fields
* An array of field labels, keyed by the field ID.
*/
protected function filter_numeric_fields(&$fields) {
foreach ($this->view->field as $id => $field) {
if (!($field instanceof views_handler_field_numeric)) {
unset($fields[$id]);
}
}
}
}