-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfer oik/content-block from oik-blocks. Remove calls to get_attri…
…butes() #180
- Loading branch information
1 parent
ffcda3e
commit 9ad01df
Showing
12 changed files
with
981 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Implements a Select Control / Text control combo where the | ||
* text value overrides the option(s) selected from the SelectControl. | ||
* | ||
* | ||
* @copyright (C) Copyright Bobbing Wide 2020 | ||
* @author Herb Miller @bobbingwide | ||
*/ | ||
|
||
|
||
const { Component, Fragment } = wp.element; | ||
const { SelectControl, TextControl } = wp.components; | ||
|
||
export class SelectTextControlCombo extends Component { | ||
constructor() { | ||
super(...arguments); | ||
|
||
} | ||
|
||
renderSelect( props ) { | ||
|
||
//var options = formats.map((format) => this.formatsOption(format)); | ||
var custom_label = `Custom value: ${this.props.label}`; | ||
return ( | ||
<Fragment> | ||
<SelectControl label={this.props.label} value={this.props.value} | ||
options={this.props.options} | ||
onChange={this.props.onChange} | ||
/> | ||
<TextControl label={custom_label} hideLabelFromVision={ true } value={this.props.value} onChange={this.props.onChange} /> | ||
</Fragment> | ||
); | ||
|
||
} | ||
|
||
|
||
|
||
/** | ||
* Map the format_option to a select list option | ||
* | ||
* @param format | ||
* @returns {{label: *, value: *}} | ||
*/ | ||
formatOption( format ) { | ||
return( { value: format.value, label: format.label }); | ||
} | ||
|
||
render() { | ||
return( this.renderSelect() | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
const { __ } = wp.i18n; | ||
|
||
const shortcode_attributes = | ||
{ | ||
shortcode: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
|
||
parameters: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
|
||
post_type: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
|
||
// post_parent = ., 0, ID null | ||
post_parent: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
|
||
// number_posts = -1, 1->100 | ||
numberposts: { | ||
type: 'integer', | ||
default: 10, | ||
}, | ||
|
||
// orderby = | ||
orderby: { | ||
type: 'string', | ||
default: 'date', | ||
}, | ||
|
||
// order = ASC / DESC | ||
order: { | ||
type: 'string', | ||
default: 'desc', | ||
}, | ||
|
||
format: { | ||
type: 'string', | ||
default: 'LIER', | ||
}, | ||
|
||
// categories= | ||
// category_name= | ||
// customcategoryname= | ||
// include | ||
// exclude | ||
// offset = null, | ||
// meta_key | ||
// meta_value | ||
// meta_compare | ||
// post_status | ||
// id=id1,id2 | ||
|
||
// posts_per_page | ||
// | ||
|
||
|
||
}; | ||
|
||
|
||
const orderby = [ | ||
{ label: 'Date', value: 'date',}, | ||
{ label: 'ID', value: 'ID',}, | ||
{ label: 'Title', value: 'title',}, | ||
{ label: 'Parent', value: 'parent', }, | ||
{ label: 'Random', value: 'rand',}, | ||
{ label: 'Menu order', value: 'menu_order',}, | ||
]; | ||
|
||
const order = | ||
[ | ||
{ | ||
label: __( 'Descending order' ), | ||
value: 'desc', | ||
}, | ||
{ | ||
label: __( 'Ascending order' ), | ||
value: 'asc', | ||
}, | ||
|
||
]; | ||
|
||
|
||
|
||
export { shortcode_attributes, orderby, order }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"apiVersion": 2, | ||
"name": "oik/content-block", | ||
"title": "Dynamic content block", | ||
"category": "layout", | ||
"icon": "shortcode", | ||
"description": "Expands content for dynamic oik shortcodes.", | ||
"attributes": { | ||
"shortcode": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"content": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"parameters": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"post_type": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"post_parent": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"numberposts": { | ||
"type": "integer", | ||
"default": 10 | ||
}, | ||
"orderby": { | ||
"type": "string", | ||
"default": "date" | ||
}, | ||
"order": { | ||
"type": "string", | ||
"default": "desc" | ||
}, | ||
"align": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"format": { | ||
"type": "string", | ||
"default": "LIER" | ||
}, | ||
"textAlign": { | ||
"type": "string" | ||
}, | ||
"className": { | ||
"type": "string" | ||
}, | ||
"textColor": { | ||
"type": "string" | ||
}, | ||
"backgroundColor": { | ||
"type": "string" | ||
}, | ||
"style": { | ||
"type": "object" | ||
}, | ||
"fontSize": { | ||
"type": "string" | ||
}, | ||
"gradient": { | ||
"type": "string" | ||
} | ||
}, | ||
"supports": { | ||
"align": true, | ||
"alignWide": true, | ||
"alignFull": true, | ||
"html": false, | ||
"customClassName": false, | ||
"className": true, | ||
"color": { | ||
"gradients": false, | ||
"text": true, | ||
"background": false, | ||
"link": false | ||
}, | ||
"typography": { | ||
"fontSize": false, | ||
"lineHeight": false | ||
} | ||
}, | ||
"keywords": [ "content", "shortcode", "dynamic", "oik" ], | ||
"textdomain": "oik-blocks" | ||
} |
Oops, something went wrong.