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\arthrolink_static_blocks\Plugin\Block; | |
use Drupal\Core\Url; | |
use Drupal\arthrolink_static_blocks\StaticBlock; | |
/** | |
* Bloc statique d'exemple. | |
* |
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
$build['quickview'] = [ | |
'#type' => 'link', | |
'#url' => Url::fromRoute('mymodule.product_quickview', ['commerce_product' => $entity->id()]), | |
'#title' => $this->t('Quick view'), | |
'#attributes' => [ | |
'class' => ['use-ajax', 'button', 'button--small', 'button--check-stock'], | |
'data-dialog-type' => 'modal', | |
'data-dialog-options' => Json::encode([ | |
'dialogClass' => 'ui-dialog--wide ui-dialog--centered-title ui-dialog--product-stock-levels', | |
'width' => 1000, |
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 | |
/** | |
* ICS.php | |
* ======= | |
* Use this class to create an .ics file. | |
* | |
* Usage | |
* ----- | |
* Basic usage - generate ics file contents (see below for available properties): |
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\yourmodule\Plugin\views\filter; | |
use Drupal\Core\Entity\Element\EntityAutocomplete; | |
use Drupal\Core\Entity\EntityStorageInterface; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\node\Entity\Node; | |
use Drupal\node\NodeStorageInterface; | |
use Drupal\views\ViewExecutable; |
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
/** | |
* Implements hook_query_TAG_alter(). | |
*/ | |
function micro_page_query_node_access_alter(\Drupal\Core\Database\Query\SelectInterface $query) { | |
// Read meta-data from query, if provided. | |
if (!($account = $query->getMetaData('account'))) { | |
$account = \Drupal::currentUser(); | |
} | |
if ($account->hasPermission('bypass node access') || $account->hasPermission('link to any page')) { | |
return; |
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
/** | |
* Massages the message body into the format expected for rendering. | |
* | |
* @param array $message | |
* The message. | |
* | |
* @return array | |
*/ | |
public function cleanBody(array $message) { | |
// Get default mail line endings and merge all lines in the e-mail body |
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
/** | |
* {@inheritdoc} | |
*/ | |
public function blockForm($form, FormStateInterface $form_state) { | |
$form['header'] = array( | |
'#type' => 'fieldset', | |
'#title' => t('Header'), | |
); | |
$form['header']['subtitle'] = array( | |
'#type' => 'textfield', |
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
<div class="contact-form"> | |
<h3><?php print t('Or by email'); ?></h3> | |
<?php print '<form id="'.$form['#id'].'" accept-charset="UTF-8" method="'.$form['#method'].'" action="'.$form['#action'].'">'; ?> | |
<?php print render($form['form_id']); ?> | |
<?php print drupal_render($form['form_build_id']);?> | |
<?php print render($form['form_token']); ?> | |
<div class="clearfix"> | |
<?php print drupal_render($form['gender']); ?> | |
</div> |
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
- | |
route_name: node.add | |
route_params: | |
entity_type: article |
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
/** | |
* Implements hook_entity_base_field_info(). | |
* | |
* - Provides a base field that displays the current workflow state on nodes. | |
* This field is intended to be used to expose this information. | |
*/ | |
function state_machine_workflow_entity_base_field_info(EntityTypeInterface $entity_type) { | |
$fields = []; | |
/** @var \Drupal\state_machine_workflow\WorkflowHelper $workflowHelper */ |