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
<!-- | |
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 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 | |
/** | |
* @file | |
* contains custom token declaration script. | |
*/ | |
/** | |
* Implements hook_token_info(). | |
*/ | |
function custom_token_info(){ | |
$types['custom_type'] = array( |
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
<textarea name="editor"></textarea> |
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 | |
// If you want to call static block in page | |
// Try below code : | |
{{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}} | |
?> | |
<?php |
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 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])) { |
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 | |
// Create A class Helper as app/Helper/Helper.php | |
use Illuminate\Support\Facades\Request; | |
Class Helper { | |
public static function getBodyClass() { | |
$body_classes = [ ]; | |
$class = ""; |
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
/** | |
* @description Below function will return a object of query string variable | |
**/ | |
var QueryString = function () { | |
// This function is anonymous, is executed immediately and | |
// the return value is assigned to QueryString! | |
var query_string = {}; | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); | |
for (var i=0;i<vars.length;i++) { |
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 | |
/** | |
* | |
* @wordpress-plugin | |
* Plugin Name: Attachment custom fields | |
* Plugin URI: http://uditrawat.com | |
* Description: Custom fields for Attachments | |
* Version: 10.3 | |
* Author: Udit Rawat | |
* Author URI: http://uditrawat.com |
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 get_ip() { | |
//Just get the headers if we can or else use the SERVER global | |
if ( function_exists( 'apache_request_headers' ) ) { | |
$headers = apache_request_headers(); | |
} else { | |
$headers = $_SERVER; | |
} |
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 | |
$hooks = array( | |
"template_fetch_template" => "template_fetch_template", | |
"store_order_item_add_start" => "store_order_item_add_start" | |
); | |
foreach ($hooks as $hook => $method){ | |
$data = array( | |
'class' => __CLASS__, | |
'method' => $hook, |