Skip to content

Instantly share code, notes, and snippets.

<?php
$field_collections = array(); // <--- change to your array of field collection data
// Time to save field_collection_item entities.
foreach ($field_collections as $field_collection_name => $field_collection_entries) {
foreach ($field_collection_entries as $delta => $field_collection) {
// Everything should be in place from before. Just save it.
$field_collection->save(TRUE);
}
}
@wizonesolutions
wizonesolutions / FillPdfForm.php
Created October 25, 2014 22:47
FillPDF in Drupal 8 scratch
<?php
/**
* Defines the entity for managing uploaded FillPDF forms.
*
* @ContentEntityType(
* id = "fillpdf_form",
* label = @Translation("FillPDF form"),
* admin_permission = "administer pdfs",
* base_table = "users",
* data_table = "users_field_data",
Meteor.startup(function () {
Session.setDefault('__blocksRendered', false);
});
// **************** SCHEDULES **************** //
Template.schedules.rendered = function () {
}
<?php
$aliases['dev'] = array(
'root' => '/srv/www/meteor/current',
'uri' => 'meteor.local',
'remote-host' => 'meteor.local',
'remote-user' => 'root',
);
sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext
sudo killall coreaudiod
GET http://app-dev.spendflow.co:3010/sockjs/info?cb=h1luc5pg81
200 OK
3ms
liveda...5e78de2 (Zeile 917)
Exception in defer callback: BlazeUIManager/self.layout@http://app-dev.spendflow.co:3010/packages/blaze-layout.js?3dc9f80fff25f73dbaaad071907ff24046419cb4:381
IronRouter<.constructor/</self[uiApiMethod]@http://app-dev.spendflow.co:3010/packages/iron-router.js?e8c8cca989caa60456d4c758e97a0455e71cae26:1441
RouteController<.constructor/</self[routerApiMethod]@http://app-dev.spendflow.co:3010/packages/iron-router.js?e8c8cca989caa60456d4c758e97a0455e71cae26:1899
@wizonesolutions
wizonesolutions / common.yml
Created December 14, 2013 18:59
Setting up Protobox with vagrant-parallels.
---
protobox:
version: 0.0.1
document: abc123
vagrant:
vm:
#box: ubuntu-precise12042-x64-vbox43
box: precise64-tools
#box_url: 'http://box.puphpet.com/ubuntu-precise12042-x64-vbox43.box'
@wizonesolutions
wizonesolutions / template.php
Created December 9, 2013 22:44
Pure evil. Seen in code while doing some maintenance work. The poor code style adds extra enjoyment.
function mytheme_error_handler($errno, $message, $filename, $line, $context) {
$aBypass = array(
'Attempt to modify property of non-object',
'expected to be a reference, value given',
);
foreach ($aBypass as $sTerm) {
if (false !== strpos($message, $sTerm)) {
return;
}
}
@wizonesolutions
wizonesolutions / README.md
Last active December 20, 2015 06:48
See README.md.

This function is intended to be used within THEMENAME_preprocess_node() (or, well, any template_preprocess_node() implementation). It parses the field collection render array and gives you direct access to the render arrays of the individual deltas. They are normally buried in a few layers of arrays and normally require you to look up the field collection item ID/revision yourself first. Often, you simply want to iterate over them and don't care about their IDs. This helper function helps solve that problem.

You pass it the $variables array and the field names of the Field Collection fields that are attached to the node and that you want to massage. It adds variables to the $variables array, named after the field + _indexed.

So if you call THEMENAME_massage_field_collections($variables, array('field_my_field_collection');, $variables['field_my_field_collection'] will exist after it's done.

It also adds a #value and #revision_id property to the variable it creates, just in case you need t

@wizonesolutions
wizonesolutions / README.md
Last active April 10, 2017 15:26
Drupal script to fix field collection items associated with multiple entities due to Content Translation/Node Clone bug.

Explanation

Drupal script to fix field collection items associated with multiple entities due to Content Translation/Node Clone bug.

**NOTE: This update hook gives every field collection item found to be associated with more than one node a new item_id. I haven't experienced any problems with doing this, but if you are doing anything special in your use case with the item_ids or revision_ids of field collection items, you should test thoroughly after running this update.

You should test thoroughly anyway, really.

TAKE A BACKUP.

How to use