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
Creating custom table in drupal 8 is not recommended. Create entity types instead. | |
But if you want to Create custom table you can create either by implementing hook_schema or | |
else create schema file config/schema/your_custom_module_name.schema.yml in your module | |
(https://www.drupal.org/docs/8/api/configuration-api/configuration-schemametadata). | |
( https://drupal.stackexchange.com/questions/219580/best-practice-for-creating-table-in-custom-module ) | |
1. Implementing hook_schema in .module file (Not recommended). | |
/** |
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
#!/bin/bash -e | |
#flag = true; tail -n-1 -f /Applications/DevDesktop/apache/logs/error_log | while read line; do if [ $flag ]; then echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier$ | |
flag=true; | |
function trigger_notification(){ | |
# if (( $flag == true )); then | |
echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier -sound default; | |
tail -n100 /Applications/DevDesktop/apache/logs/error_log > /tmp/log.txt; |
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
#!/bin/bash -e | |
#flag = true; tail -n-1 -f /Applications/DevDesktop/apache/logs/error_log | while read line; do if [ $flag ]; then echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier$ | |
flag=true; | |
function trigger_notification(){ | |
# if (( $flag == true )); then | |
echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier -sound default; | |
tail -n100 /Applications/DevDesktop/apache/logs/error_log > /tmp/log.txt; |
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
https://www.cloudways.com/blog/best-startup-books-for-new-entrepreneurs/ | |
var bookstitle; jQuery("h2").each(function(index) { | |
bookstitle += " @BooksBag " + $(this).text() + " by " + $( this).next("p").next("p").clone() //clone the element | |
.children() //select all the children | |
.remove() //remove all the children | |
.end().text(); console.log(bookstitle); | |
}); | |
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
<?php | |
require_once customization_module_file_path(); | |
/** | |
* @return string test.module file path | |
*/ | |
function customization_module_file_path() { | |
// The directory of the file | |
$customizationsmodulepath = __DIR__; | |
/** |
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
// get all ids of checkbox | |
var someObj={}; | |
someObj.fruitsGranted=[]; | |
someObj.fruitsDenied=[]; | |
jQuery(“.js-rid-admin”).each(function() { | |
var $this = jQuery(this); | |
if($this.is("checked")){ | |
someObj.fruitsGranted.push($this.attr("id")); |
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
use Drupal\Core\Language\LanguageInterface; | |
echo strcmp("/", "/"); | |
$test = \Drupal::service("pathauto.alias_cleaner")->cleanString("1"); | |
$langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; | |
$source = ""; | |
$alias = $test; | |
$test = \Drupal::service("pathauto.alias_uniquifier")->uniquify($alias, $source, $langcode) ; | |
use Drupal\Core\Language\LanguageInterface; | |
echo strcmp("/", "/"); |
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
$entity = EntityTest::create(); | |
$entity->field_datasheet->target_id = $this->file->id(); | |
$entity->save(); | |
$output = $this->renderTestEntity($entity->id()); | |
$expected_link = Link::fromTextAndUrl($this->field_label, Url::fromUri(file_create_url($this->file->getFileUri()))); | |
$expected_link = $expected_link->toRenderable(); | |
$expected_link['#attributes'] = [ | |
'target' => '_blank', | |
]; | |
$expected_link = \Drupal::service('renderer')->renderRoot($expected_link); |
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
$menu = \Drupal::entityTypeManager() | |
->getStorage('menu_link_content') | |
->loadByProperties([ | |
'menu_name' => ['agile-central-menu'], | |
'link.uri' => [ "entity:node/960"] | |
]); | |
If ($menu ) { | |
$menu->delete(); | |
} |
NewerOlder