This file contains hidden or 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
<?php | |
namespace Drupal\feeds_sftp_fetcher\Feeds\Fetcher; | |
use Drupal\Core\File\FileSystemInterface; | |
use Drupal\Core\Logger\LoggerChannelFactoryInterface; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Drupal\Core\Utility\Token; | |
use Drupal\feeds\Exception\EmptyFeedException; | |
use Drupal\feeds\FeedInterface; |
This file contains hidden or 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
<?xml version='1.0' encoding='UTF-8'?> | |
<countries> | |
<country code='af' handle='afghanistan' continent='asia' iso='4'>Afghanistan</country> | |
<country code='al' handle='albania' continent='europe' iso='8'>Albania</country> | |
<country code='dz' handle='algeria' continent='africa' iso='12'>Algeria</country> | |
<country code='as' handle='american-samoa' continent='polynesia' iso='16'>American Samoa</country> | |
<country code='ad' handle='andorra' continent='europe' iso='20'>Andorra</country> | |
<country code='ao' handle='angola' continent='africa' iso='24'>Angola</country> | |
<country code='ai' handle='anguilla' continent='north america' iso='660'>Anguilla</country> | |
<country code='aq' handle='antarctica' continent='antarctica' iso='10'>Antarctica</country> |
This file contains hidden or 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
<?php | |
/** | |
* Utility: find term by name and vid. | |
* @param null $name | |
* Term name | |
* @param null $vid | |
* Term vid | |
* @return int | |
* Term id or 0 if none. |
This file contains hidden or 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
<?php | |
/** If vocabulary id not exist */ | |
if(!\Drupal\taxonomy\Entity\Vocabulary::load($vocab_id)){ | |
/** | |
* Create vocabulary | |
* @var $vocabulary | |
*/ | |
$vocabulary = \Drupal\taxonomy\Entity\Vocabulary::create([ | |
'vid' => $vocab_id, |
This file contains hidden or 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
// I generally use the typeof operator: | |
if (typeof obj.foo !== 'undefined') { | |
// your code here | |
} | |
// It will return "undefined" either if the property doesn't exist or its value is undefined. | |
// There are other ways to figure out if a property exists on an object, like the hasOwnProperty method: |
This file contains hidden or 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
/** EXAMPLE 1 ***/ | |
var $myDialog = $('<div>My dialog text</div>').appendTo('body'); | |
Drupal.dialog($myDialog, { | |
title: 'A title', | |
buttons: [{ | |
text: 'Close', | |
click: function() { | |
$(this).dialog('close'); | |
} | |
}] |
This file contains hidden or 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
<input type='text' id='text'> |
This file contains hidden or 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
<!-- | |
There is a new move node in the layout xml that we have access to in M2. | |
This node sets the declared block or container element as a child of another | |
element in the specified order. | |
--> | |
<!-- EXAMPLE --> | |
<move element="name.of.an.element" destination="name.of.destination.element" as="new_alias" after="name.of.element.after" before="name.of.element.before"/> | |
<!-- In the example you provided before you should just be able to call: --> |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook hook_form_node_form_alter | |
**/ | |
function hook_form_node_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { | |
foreach (array_keys($form['actions']) as $action) { | |
if(is_array($form['actions'][$action])) { |
NewerOlder