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
/* @noinspection PhpAbstractStaticMethodInspection */ | |
/* @noinspection PhpHierarchyChecksInspection */ | |
/* @noinspection PhpUnreachableStatementInspection */ | |
/* @noinspection PhpUnusedLocalVariableInspection */ | |
/* @noinspection PhpWrongCatchClausesOrderInspection */ | |
/* @noinspection PhpDeprecationInspection */ | |
/* @noinspection PhpDocMissingReturnTagInspection */ | |
/* @noinspection PhpDocMissingThrowsInspection */ | |
/* @noinspection PhpDocSignatureInspection */ | |
/* @noinspection PhpMissingDocCommentInspection */ |
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 | |
/* | |
* Mask before start | |
* 000000 | |
* 111111 | |
* 222222 | |
* | |
* First row | |
* 001122 | |
* |
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
add_class_to_body: | |
js: | |
js/add_class_to_body.js: {} |
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 | |
/** | |
* Implements hook_ENTITY_TYPE_insert() for node entities. | |
*/ | |
function taxonomy_node_insert(EntityInterface $node) { | |
// Add taxonomy index entries for the node. | |
taxonomy_build_node_index($node); | |
} | |
/** | |
* Implements hook_ENTITY_TYPE_update() for node entities. |
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 | |
use Drupal\node\NodeInterface; | |
use Drupal\taxonomy\TermInterface; | |
/** | |
* Implements hook_ENTITY_TYPE_delete() for taxonomy_term entities. | |
* | |
* @throws \Drupal\Core\Entity\EntityStorageException | |
*/ |
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 | |
namespace Drupal\MODULE_NAME\Plugin\Filter; | |
use Drupal\Component\Utility\Html; | |
use Drupal\filter\FilterProcessResult; | |
use Drupal\filter\Plugin\FilterBase; | |
/** | |
* Filter Link Title attribute. |
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 | |
/** | |
* Applies text editor XSS filtering. | |
* | |
* @param string $html | |
* The HTML string that will be passed to the text editor. | |
* @param \Drupal\filter\FilterFormatInterface|null $format | |
* The text format whose text editor will be used or NULL if the previously | |
* defined text format is now disabled. |
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 | |
/** | |
* Implements hook_editor_xss_filter_alter(). | |
*/ | |
function MODULE_NAME_editor_xss_filter_alter( | |
&$editor_xss_filter_class, | |
FilterFormatInterface $format, | |
FilterFormatInterface $original_format = NULL | |
) { |
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 | |
namespace Drupal\MODULE_NAME\EditorXssFilter; | |
use Drupal\Component\Utility\Html; | |
use Drupal\editor\EditorXssFilter\Standard; | |
/** | |
* Defines the standard text editor with styles XSS filter. | |
*/ |
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 | |
function htmlTruncate(string $html, int $max_lenght) { | |
$dom= new \DOMDocument(); | |
$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); | |
$xpath = new \DOMXPath($dom); | |
$body = $xpath->query('/html/body')->item(0); | |
$prev_lenght = 0; |
OlderNewer