Skip to content

Instantly share code, notes, and snippets.

View damiankloip's full-sized avatar

Damian Lee damiankloip

View GitHub Profile
function views_field_view_views_data_alter(&$data) {
$data['views']['view'] = array(
'title' => t('View'),
'help' => t('Embed a view as field. This can cause slow performance, so enable some caching.'),
'field' => array(
'handler' => 'views_field_view_handler_field_view',
),
);
$data['views']['view_field'] = array(
'title' => t('View'),
function xml_to_array(SimpleXMLIterator $xml) {
$out = array();
foreach ($xml as $key => $value) {
if ($xml->hasChildren()) {
$out[$key] = xml_to_array($value);
}
else {
if ($attributes = (array) $value->attributes()) {
$out['#attributes'] = $attributes['@attributes'];
<?php
/**
* @file
* Tests different parts of the ctools export system.
*/
/**
* Tests export crud.
*/
/**
* @todo.
*/
public function pack($exportable) {
$data = array();
foreach ($this->schema['fields'] as $field => $info) {
if (isset($exportable->{$field})) {
$data[$field] = $exportable->{$field};
}
public function getExporter() {
if (empty($this->exporter)) {
if (class_exists($this->info['exporter class'])) {
$reflection = new \ReflectionClass($this->info['exporter class']);
if ($reflection->implementsInterface('Drupal\ctools\ExporterInterface')) {
$this->exporter = $reflection->newInstance();
}
else {
return FALSE;
}
$array_view = (array) views_get_view('archive');
foreach ($array_view['display'] as $key => $display) {
$array_view['display'][$key] = (array) $display;
}
dpm($array_view);
'backlinks' => array(
'disabled' => false,
'vid' => '1',
'name' => 'backlinks',
'description' => 'Displays a list of nodes that link to the node, using the search backlinks table.',
'tag' => 'default',
'base_table' => 'node',
'human_name' => 'Backlinks',
'core' => '0',
'display' =>
<?php
/**
* @file
* Definition of Drupal\views\Tests\Ui\Wizard\Helper.
*/
namespace Drupal\views\Tests\Ui\Wizard;
use ViewsSqlTest;
<?php
function get_token_value($token, $values, $view) {
$value = NULL;
$token_info = $this->get_token_argument($token);
$arg = $token_info['arg'];
$token_type = $token_info['type'];
// Collect all of the values that we intend to use as arguments of our single query.
if (isset($view->field[$arg])) {
class views_handler_filter_entity_type extends views_handler_filter_in_operator {
function get_value_options() {
if (!isset($this->value_options)) {
$table_data = views_fetch_data($this->view->base_table);
$this->entity_type = $table_data['table']['entity type'];
$info = entity_get_info($this->entity_type);
$types = $info['bundles'];
$this->value_title = t('@entity types', array('@entity' => $info['label']));
$options = array();