Skip to content

Instantly share code, notes, and snippets.

View wdebusschere's full-sized avatar
💭
Laravel / Kirby CMS

Wannes Debusschere wdebusschere

💭
Laravel / Kirby CMS
View GitHub Profile
@wdebusschere
wdebusschere / ds-custom-order-field.md
Last active April 1, 2019 15:43
Datasource Custom order field
public function execute(array &$param_pool = null)
	{

		$ordercolumn = $this->__processParametersInString('$url-order.1.column', $this->_env, false);

		switch ($ordercolumn) {
		case "0":
			$this->dsParamSORT = "name";
 break;
@wdebusschere
wdebusschere / Entrymanager-fetch.md
Last active March 30, 2019 21:45
Entrymanager fetch
//  fetch($entry_id=NULL, $section_id=NULL, $limit=NULL, $start=NULL, $where=NULL, $joins=NULL, $group=false, $buildentries=true, $element_names=null){
		  	$em = new EntryManager();

		    $entries = $em->fetch(null, 83, 10, 0, false, false, false, true, array ('title'));

		  //  	echo "<h2>Products</h2><pre>";print_r($entries);echo "</pre>";die;
        	$product_em = new EntryManager();
		$product_fields = array ('title');
		$products = $product_em->fetch(
@wdebusschere
wdebusschere / SymCMS - Getting data notes.mkd
Created March 29, 2019 09:02 — forked from DavidOliver/SymCMS - Getting data notes.mkd
Notes on getting data from within Symphony CMS

Written based on hacking away at a custom event which aimed to take its data solely from entry data and $_SESSION values, and not posted values (which I understand may have been open to DOM hacking and required "ugly" frontend hidden fields).

Things I think I've learned

Use Xpath in PHP when possible

I was traversing the XMLElement object generated by SymQL (or Entry object generated by EntryManager) with the object's methods and foreach to get values, which seems to require a lot of effort and code:

php
<?php
Class contentExtensionReferencelinkAutocomplete extends AjaxPage{
public function handleFailedAuthorisation(){
$this->_status = self::STATUS_UNAUTHORISED;
$this->_Result = json_encode(array('status' => __('You are not authorised to access this page.')));
}
public function view(){
1. extension.meta.xml
<release version="2.1.3" date="2018-10-01" min="2.4" max="2.x.x">
in the config.php add to the log settings the following line 'filter' => 24575,

html

<label class="uk-hidden">Leave this field empty:</label>
<input class="uk-hidden" type="text" name="phoneNumber6tY4bPYk" autocomplete="off" />```


# css

.uk-hidden {

@wdebusschere
wdebusschere / data.dsRoles.php
Last active November 19, 2018 16:32
Custom datasource Member roles
<?php
class datasourcedsRoles extends SectionDatasource
{
public $dsParamROOTELEMENT = 'dsRoles';
public $dsParamCACHE = -1;
public $dsParamFILTERS = array(
@wdebusschere
wdebusschere / data.dscustom.php
Created October 31, 2018 14:43
Custom datasource with symql
<!--
Usecase example:
-->
public function allowEditorToParse()
{
return false;
}
public function execute(array &$param_pool = null)
@wdebusschere
wdebusschere / data.ds1.php
Created October 31, 2018 12:07
Dynamic url parameters in a datasource
<!--
Usecase example: You want to unset the price filter if the $url-price is 0
-->
<?php
class datasourceds1 extends SectionDatasource
{
public $dsParamROOTELEMENT = 'ds1';
public $dsParamORDER = '{$url-order:desc}';
public $dsParamPAGINATERESULTS = 'yes';
public $dsParamLIMIT = '20';