Using Inline Entity Form
- use
hook_inline_entity_form_table_fields_alter(&$fields, $context)to customise the way it looks in the CMS form
| <? | |
| /** | |
| * override global config settings with local settings - add to the bottom of the global config file | |
| * Server Specfic variables from unversion included file - if it exists | |
| */ | |
| $abspath = dirname(__FILE__); | |
| if(file_exists($abspath.'/settings.local.php')){ | |
| include $abspath.'/settings.local.php'; |
| <? | |
| /* | |
| * Detect whether the current query is ajax | |
| * | |
| * TODO: check if this works across browsers and ajax libraries | |
| */ | |
| function is_xhr() | |
| { | |
| if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && | |
| strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') |
| /** | |
| * ----------------------------- | |
| * Articles List (Home Page) | |
| * ----------------------------- | |
| */ | |
| ;(function($){ | |
| $.fn.articlesList = function() { | |
| var articleslist = this; |
| <?php | |
| /* | |
| Plugin Name: Plugin Boilerplate | |
| Version: 0.1-alpha | |
| Description: This is how I like to make sense of the WordPress plugin architecture | |
| Author: Adam Davis | |
| Author URI: http://admataz.com | |
| Plugin URI: http://admataz.com | |
| Text Domain: admataz-plugin-boilerplate | |
| Domain Path: /languages |
| <?php | |
| new ThemeName(); | |
| class ThemeName { | |
| /** | |
| * Starting off… | |
| */ | |
| function __construct() { | |
| //add_editor_style(); |
| //define a module that returns a noConflict version of jQuery | |
| define(['jquery'], function (jq) { | |
| return jq.noConflict( true ); | |
| }); |
| <?php | |
| function make_node_programmatically()($title) { | |
| global $user; | |
| $node = new stdClass(); // We create a new node object | |
| $node->type = "pages"; // Or any other content type you want | |
| $node->title = $title; | |
| $node->language = LANGUAGE_NONE; | |
| node_object_prepare($node); // Set some default values. | |
| $node->uid = $user->uid; // Or any id you wish | |
| $node = node_submit($node); // Prepare node for a submit |
hook_inline_entity_form_table_fields_alter(&$fields, $context) to customise the way it looks in the CMS form| <?php | |
| function calc_aspect_ratio($w=0,$h=0,$image_dimensions=array()){ | |
| //work out some ratios for the resized dimensions | |
| if($w){ | |
| $w_ratio=$w/$image_dimensions[0]; | |
| } else { | |
| $w_ratio=1; | |
| } | |
| if($h){ | |
| $h_ratio=$h/$image_dimensions[1]; |
| /** | |
| * Using nconf to manage hierarchical configuration | |
| * https://www.npmjs.com/package/nconf | |
| */ | |
| 'use strict'; | |
| var nconf = require('nconf'); | |
| var config = { |