// Load file object
$file = File::load($fid);
// Get uri (public://foo/bar/baz.png)
$uri = $file->getFileUri();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const forum = express(); | |
forum | |
.get('/healthz', (req, res, next) => { | |
res.send({ name: 'forum', status: 'healthy' }); | |
next(); | |
}) | |
.get('/d/:id', (req, res, next) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */ | |
//return an array of objects according to key, value, or key and value matching | |
function getObjects(obj, key, val) { | |
var objects = []; | |
for (var i in obj) { | |
if (!obj.hasOwnProperty(i)) continue; | |
if (typeof obj[i] == 'object') { | |
objects = objects.concat(getObjects(obj[i], key, val)); | |
} else |
See discussion at https://www.drupal.org/project/drupal/issues/937442
- Check if this can be done better with https://www.agoradesign.at/blog/why-running-drupalentitydefinitionupdatemanager-applyupdates-update-hooks-bad
- https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityDefinitionUpdateManager.php/function/EntityDefinitionUpdateManager%3A%3AupdateFieldStorageDefinition/8.2.x
This workaround is based on code from "Address" contrib module: https://www.drupal.org/project/address Thanks to @bojanz who initially wrote it here: https://git.drupalcode.org/project/address/-/blob/8.x-1.x/address.install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Are all the values on p present on o | |
* @param {Object} o object to search | |
* @param {Object} p object of search values | |
* @param {Boolean} [c] are loose equality matches ok? | |
* @return {Boolean} whether there are partial matches | |
*/ | |
const partialMatch = (o, p, c) => | |
Object.keys(p).every(k => | |
p[k] && o[k] |
OlderNewer