Skip to content

Instantly share code, notes, and snippets.

View heyrocker's full-sized avatar

Greg Dunlap heyrocker

View GitHub Profile
function dartmouth_server_entity_load(array $entities, $entity_type_id) {
if ($entity_type_id == "node") {
$request = \Drupal::request();
$controller = $request->get("_controller");
$staging = $request->query->get("staging");
if ($staging == "TRUE" && strpos($controller, "jsonapi") !== false) {
// If we are previewing…
foreach ($entities as $entity) {
// Get the nid of the current entity

#The Last Silo

##Intro

  • With the rise of Agile we have spent a lot of time in the last several years promoting cross-functional teams as being integral to the creation of software.
  • This is awesome, and it has vastly increased our ability to work sanely.
  • Despite all this, it is still depressingly common for site design to be completely silo'd off from everything else.
  • The result of this is, very often, a design that is not actually implementable.
  • This effect is exacerbated when combined the restrictions when building to a CMS (both in terms of technology and editorial experience).
  • It's time to tear down the wall between design and implementation.
<?php
public function getSOMPath($url, $path, $langcode) {
// Load the site's parent link configuration.
/** @var \Drupal\Core\Config\ImmutableConfig $site_config */
$site_config = \Drupal::config('som_breadcrumb.settings');
$data = $site_config->get('site.active_trail');
// Load the site homepage alias
$site_config = \Drupal::config('system.site');
<?php
namespace Drupal\csv_content_import\Forms;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\UrlHelper;
use Drupal\node\Entity\Node;
use Symfony\Component\Validator\Constraints\Null;
use Drupal\menu_link_content\Entity\MenuLinkContent;
initialize state vars
$menu_hierarchy = array();
$last_column = 1;
$last_menu_item = array();
while there are records to read
$node = array();
get record into $record;
$record = array_filter($record); // Strip empty values while retaining indexes
$title_column = key($record); // Get the index for the first column, which will be the one with our title in it
diff --git a/access_unpublished.module b/access_unpublished.module
index f2b7db5..cb42c03 100644
--- a/access_unpublished.module
+++ b/access_unpublished.module
@@ -34,6 +34,12 @@ function access_unpublished_permission() {
'title' => t('View unpublished contents'),
'description' => t('Allow users to view unpublished contents with unique key in URL path'),
);
+ if (module_exists('workbench_moderation')) {
+ $permissions['access unpublished view workbench moderation drafts'] = array(
PRODUCTION:
http://170.171.208.162:8081/solr/rhcanada/select?fl=item_id%2Cscore&qf=tm_body%24value%5E2.0&qf=tm_field_article_category%24name%5E1.0&qf=tm_field_author_ref%24title%5E5.0&qf=tm_field_description%24value%5E1.0&qf=tm_field_division%24name%5E1.0&qf=tm_field_flapcopy%24value%5E1.0&qf=tm_field_full_length_title%5E3.0&qf=tm_field_imprint%24title%5E3.0&qf=tm_field_isbn%5E21.0&qf=tm_field_isbn10%5E21.0&qf=tm_field_related_authors%24title%5E2.0&qf=tm_field_related_books%24title%5E2.0&qf=tm_field_related_content%24title%5E2.0&qf=tm_field_relatedisbns%24field_sub_title%5E2.0&qf=tm_field_relatedisbns%24field_subtitle%5E1.0&qf=tm_field_relatedisbns%24title%5E2.0&qf=tm_field_rhc_short_title%5E1.0&qf=tm_field_series%24name%5E2.0&qf=tm_field_slices%24title%5E1.0&qf=tm_field_spotlight%24value%5E1.0&qf=tm_field_sub_title%5E2.0&qf=tm_field_subjectcategories%24api_content_id%5E1.0&qf=tm_field_subjectcategories%24name%5E1.0&qf=tm_field_subtitle%5E2.0&qf=tm_field_tags%24name%5E1.0&qf=tm_title%5E8.0&fq=%2A%3A%2A%20AND%
calendar: [
{
calendar_id: "6888",
tournament_id: "1454",
tournament_name: "X-tra Ball Monthly Tournament",
city: "Charlotte",
state: "NC",
country_name: "United States",
country_code: "US",
euro_champ_flag: "N",
calendar: {
7113: {
calendar_id: "7113",
tournament_id: "1316",
tournament_name: "Pintastic Pin-O-rama Pingolf Tournament",
city: "Las Vegas",
state: "NV",
country_name: "United States",
country_code: "US",
euro_champ_flag: "N",
$field_name = 'field_article_type';
// Get the field info
$original_field = field_info_field($field_name);
$settings = $original_field['settings'];
$settings['allowed_values'] = array(
'articles' => 'Articles',
'news' => 'News',
'videos' => 'Videos',
);
// Create the data array that will be forced manually