Add upstream plugins

Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
2019-10-25 22:42:20 +02:00
parent 5d3c2ec184
commit 290736650a
1186 changed files with 302577 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
<?php
/**
* Abstract class to accelerate settings page snippets development.
*
* @author Time.ly Network, Inc.
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
abstract class Ai1ec_Html_Element_Settings extends Ai1ec_Base
implements Ai1ec_Html_Element_Interface {
/**
* @var Ai1ec_Html_Helper Instance of HTML helper.
*/
protected $_html = NULL;
/**
* @var array Map of arbitrary arguments passed to an element.
*/
protected $_args = array();
/**
* Constructor accepts system as injectable and requests HTML helper.
*
* @param Ai1ec_Registry_Object $system Injected system argument.
*
* @return void Constructor does not return.
*/
public function __construct(
Ai1ec_Registry_Object $registry,
array $args
) {
parent::__construct( $registry );
$this->_args = $args;
$this->_html = $registry->get( 'html.helper' );
}
/**
* Set value within current object scope
*
* Value name is formed as {$attribute} with underscore ('_') prefixed.
*
* @param string $attribute Name of attribute to set.
* @param mixed $value Value to set for attribute.
*
* @return Ai1ec_Html_Element_Settings Instance of self.
*/
public function set( $attribute, $value ) {
$this->{'_' . $attribute} = $value;
return $this;
}
/**
* Override to include any initialization logics.
*
* @return void Method output is ignored.
*/
protected function _initialize() {
}
/**
* Generate settings output line.
*
* @param string $output Generated output to finalize.
* @param bool $wrap Whether content should be wrapped with div or not.
*
* @return string Finalized HTML snippet.
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
if ( isset( $this->_args['renderer']['condition'] ) ) {
$condition = $this->_args['renderer']['condition'];
if ( is_bool( $condition ) ) {
$render = $condition;
} else {
$callback = explode( ':', $this->_args['renderer']['condition'] );
try {
$render = $this->_registry->dispatch(
$callback[0],
$callback[1]
);
} catch (Ai1ec_Bootstrap_Exception $exception) {
$render = '';
}
}
if ( ! $render ) {
return '';
}
}
if ( ! $wrap ) {
return $output;
}
if ( $hidden ) {
return '<div class="ai1ec-form-group ai1ec-hidden">' . $output . '</div>';
} else {
return '<div class="ai1ec-form-group">' . $output . '</div>';
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* Renderer of settings page html.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Cache extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$args = $this->get_twig_cache_args();
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/twig_cache.twig', $args, true );
return parent::render( $file->get_content(), $wrap, $hidden );
}
/**
* Returns data for Twig template.
*
* @return array Data for template
*/
public function get_twig_cache_args() {
$args = array(
'cache_available' => (
AI1EC_CACHE_UNAVAILABLE !== $this->_args['value'] &&
! empty( $this->_args['value'] )
),
'id' => $this->_args['id'],
'label' => $this->_args['renderer']['label'],
'text' => array(
'refresh' => Ai1ec_I18n::__( 'Check again' ),
'nocache' => Ai1ec_I18n::__( 'Templates cache is not writable' ),
'okcache' => Ai1ec_I18n::__( 'Templates cache is writable' ),
'rescan' => Ai1ec_I18n::__( 'Checking...' ),
'title' => Ai1ec_I18n::__( 'Performance Report' ),
),
);
return $args;
}
}

View File

@@ -0,0 +1,124 @@
<?php
/**
* Renderer of settings page Calendar page selection snippet.
*
* @author Time.ly Network, Inc.
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Element_Calendar_Page_Selector
extends Ai1ec_Html_Element_Settings {
/**
* @var string HTML id attribute for selector.
*/
const ELEMENT_ID = 'calendar_page_id';
/**
* @var array Map of pages defined in system, use `get_pages()` WP call.
*/
protected $_pages = array();
/**
* Set attributes for element.
*
* Currently recognized attributes:
* - 'pages' - {@see self::$_pages} for details;
* - 'selected' - {@see self::$_selected} for details.
*
* @param string $attribute Name of attribute to set.
* @param mixed $value Value to set for attribute.
*
* @return Ai1ec_Html_Element_Calendar_Page_Selector Instance of self.
*/
public function set( $attribute, $value ) {
// any validation may be provided here
return parent::set( $attribute, $value );
}
/**
* Generate HTML snippet for inclusion in settings page.
*
* @param string $snippet Particle to append to result.
*
* @return string HTML snippet for page selection.
*/
public function render( $snippet = '', $wrap = true, $hidden = false ) {
$output = '<label class="ai1ec-control-label ai1ec-col-sm-5" for="' .
self::ELEMENT_ID . '">' . Ai1ec_I18n::__( 'Calendar page' ) . '</label>'
. '<div class="ai1ec-col-sm-7">' .
$this->_get_pages_selector() . $this->_get_page_view_link() . '</div>';
return parent::render( $output, $wrap, $hidden );
}
/**
* Generate link to open selected page in new window.
*
* @return string HTML snippet.
*/
protected function _get_page_view_link() {
if ( empty( $this->_args['value'] ) ) {
return '';
}
$post = get_post( $this->_args['value'] );
if ( empty( $post->ID ) ) {
return '';
}
$args = array(
'view' => Ai1ec_I18n::__( 'View' ),
'link' => get_permalink( $post->ID ),
'title' => apply_filters(
'the_title',
$post->post_title,
$post->ID
),
);
return $this->_registry->get( 'theme.loader' )
->get_file( 'setting/calendar-page-selector.twig', $args, true )
->get_content();
}
/**
* Generate dropdown selector to choose page.
*
* @return string HTML snippet.
*/
protected function _get_pages_selector() {
$html = '<select id="' . self::ELEMENT_ID .
'" class="ai1ec-form-control" name="' . self::ELEMENT_ID . '">';
$list = $this->_get_pages();
foreach ( $list as $key => $value ) {
$html .= '<option value="' . $this->_html->esc_attr( $key ) . '"';
if ( $this->_args['value'] === $key ) {
$html .= ' selected="selected"';
}
$html .= '>' . $this->_html->esc_html( $value ) . '</option>';
}
$html .= '</select>';
return $html;
}
/**
* Make a map of page IDs and titles for selection snippet.
*
* @return array Map of page keys and titles.
*/
protected function _get_pages() {
$pages = get_pages();
if ( ! is_array( $pages ) ) {
$pages = array();
}
$output = array(
'__auto_page:Calendar' => Ai1ec_I18n::__(
'- Auto-Create New Page -'
),
);
foreach ( $pages as $key => $value ) {
$output[$value->ID] = $value->post_title;
}
return $output;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* Renderer of settings page checkbox option.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Settings_Checkbox extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$attributes = array(
'class' => 'checkbox',
);
if ( true === $this->_args['value'] ) {
$attributes['checked'] = 'checked';
}
$args = $this->_args;
$args['attributes'] = $attributes;
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file(
'setting/checkbox.twig',
$args,
true
);
return parent::render( $file->get_content(), $wrap, $hidden );
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Renderer of settings page custom option.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.4
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Custom extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$label = $this->_args['renderer']['label'];
$content = $this->_args['renderer']['content'];
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/custom.twig', array(
'label' => $label,
'content' => $content
), true );
return parent::render( $file->get_content(), $wrap, $hidden );
}
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Renderer of settings page Enabled views selection snippet.
*
* @author Time.ly Network, Inc.
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Element_Enabled_Views
extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$this->_convert_values();
$args = array(
'views' => $this->_args['value'],
'label' => $this->_args['renderer']['label'],
'text_enabled' => __( 'Enabled', AI1EC_PLUGIN_NAME ),
'text_default' => __( 'Default', AI1EC_PLUGIN_NAME ),
'text_desktop' => __( 'Desktop', AI1EC_PLUGIN_NAME ),
'text_mobile' => __( 'Mobile', AI1EC_PLUGIN_NAME ),
);
$loader = $this->_registry->get( 'theme.loader' );
return $loader->get_file( 'setting/enabled-views.twig', $args, true )
->get_content();
}
/**
* Convert values to bo used in rendering
*/
protected function _convert_values() {
foreach( $this->_args['value'] as &$view ) {
$view['enabled'] = $view['enabled'] ?
'checked="checked"' :
'';
$view['default'] = $view['default'] ?
'checked="checked"' :
'';
// Use mobile settings if available, else fall back to desktop settings.
$view['enabled_mobile'] = isset( $view['enabled_mobile'] ) ?
( $view['enabled_mobile'] ?
'checked="checked"' :
'' ) :
$view['enabled'];
$view['default_mobile'] = isset( $view['default_mobile'] ) ?
( $view['default_mobile'] ?
'checked="checked"' :
'' ) :
$view['default'];
$view['longname'] = translate_nooped_plural(
$view['longname'],
1
);
}
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* Renderer of settings page html.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Html extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$file = $this->_args['id'] . '.twig';
$method = 'get_' . $this->_args['id'] . '_args';
$args = array();
if ( method_exists( $this, $method ) ) {
$args = $this->{$method}();
}
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/' . $file, $args, true );
return parent::render( $file->get_content(), $wrap, $hidden );
}
/*
* Get embedding arguments
*
* @return array
*/
protected function get_embedding_args() {
return array(
'viewing_events_shortcodes' => apply_filters( 'ai1ec_viewing_events_shortcodes', null ),
'text_embed_shortcode' => __( 'Embed the calendar using a shortcode', AI1EC_PLUGIN_NAME ),
'text_insert_shortcode' => __( 'Insert one of these shortcodes into your page body to embed the calendar into any arbitrary WordPress Page:', AI1EC_PLUGIN_NAME ),
'text_month_view' => __( 'Month view:', AI1EC_PLUGIN_NAME ),
'text_week_view' => __( 'Week view:', AI1EC_PLUGIN_NAME ),
'text_day_view' => __( 'Day view:', AI1EC_PLUGIN_NAME ),
'text_agenda_view' => __( 'Agenda view:', AI1EC_PLUGIN_NAME ),
'text_other_view' => __( 'Some Other view:', AI1EC_PLUGIN_NAME ),
'text_default_view' => __( 'Default view as per settings:', AI1EC_PLUGIN_NAME ),
'text_general_form' => __( 'General form:', AI1EC_PLUGIN_NAME ),
'text_optional' => __( 'Optional.', AI1EC_PLUGIN_NAME ),
'text_filter_label' => __( 'Add options to display a filtered calender. (You can find out category and tag IDs by inspecting the URL of your filtered calendar page.)', AI1EC_PLUGIN_NAME ),
'text_filter_category' => __( 'Filter by event category name/slug:', AI1EC_PLUGIN_NAME ),
'text_filter_category_1' => __( 'Holidays', AI1EC_PLUGIN_NAME ),
'text_filter_category_2' => __( 'Lunar Cycles', AI1EC_PLUGIN_NAME ),
'text_filter_category_3' => __( 'zodiac-date-ranges', AI1EC_PLUGIN_NAME ),
'text_filter_category_comma' => __( 'Filter by event category names/slugs (separate names by comma):', AI1EC_PLUGIN_NAME ),
'text_filter_category_id' => __( 'Filter by event category ID:', AI1EC_PLUGIN_NAME ),
'text_filter_category_id_comma' => __( 'Filter by event category IDs (separate IDs by comma):', AI1EC_PLUGIN_NAME ),
'text_filter_tag' => __( 'Filter by event tag name/slug:', AI1EC_PLUGIN_NAME ),
'text_filter_tag_1' => __( 'tips-and-tricks', AI1EC_PLUGIN_NAME ),
'text_filter_tag_2' => __( 'creative writing', AI1EC_PLUGIN_NAME ),
'text_filter_tag_3' => __( 'performing arts', AI1EC_PLUGIN_NAME ),
'text_filter_tag_comma' => __( 'Filter by event tag names/slugs (separate names by comma):', AI1EC_PLUGIN_NAME ),
'text_filter_tag_id' => __( 'Filter by event tag ID:', AI1EC_PLUGIN_NAME ),
'text_filter_tag_id_comma' => __( 'Filter by event tag IDs (separate IDs by comma):', AI1EC_PLUGIN_NAME ),
'text_filter_post_id' => __( 'Filter by post ID:', AI1EC_PLUGIN_NAME ),
'text_filter_post_id_comma' => __( 'Filter by post IDs (separate IDs by comma):', AI1EC_PLUGIN_NAME ),
'text_events_limit' => __( 'Limit number of events per page:', AI1EC_PLUGIN_NAME ),
'text_warning' => __( 'Warning:', AI1EC_PLUGIN_NAME ),
'text_single_calendar' => __( 'It is currently not supported to embed more than one calendar in the same page. Do not attempt to embed the calendar via shortcode in a page that already displays the calendar.', AI1EC_PLUGIN_NAME ),
);
}
}

View File

@@ -0,0 +1,98 @@
<?php
/**
* Renderer of settings page input option.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Input extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$system = $this->_registry->get( 'date.system' );
$type = $this->_args['renderer']['type'];
$date = $append = false;
$class = '';
$input_type = 'text';
switch ( $type ) {
case 'date':
$date = true;
break;
case 'append':
$append = true;
break;
case 'email':
$input_type = 'email';
break;
case 'url':
$input_type = 'url';
break;
case 'number':
$input_type = 'number';
break;
case 'checkbox':
$input_type = 'checkbox';
break;
}
$input_args = array(
'class' => $class,
);
$settings = $this->_registry->get( 'model.settings' );
if ( true === $date ) {
$input_args += array(
'data-date-weekstart' => $settings->get( 'week_start_day' ),
'data-date-format' => $system->get_date_pattern_by_key(
$settings->get( 'input_date_format' )
),
'size' => 12,
);
}
$args = array(
'id' => $this->_args['id'],
'label' => $this->_args['renderer']['label'],
'input_args' => $input_args,
'input_type' => $input_type,
'value' => $this->_args['value'],
);
if ( isset( $this->_args['renderer']['status'] ) ) {
$args['licence_valid'] =
$settings->get( $this->_args['renderer']['status'] ) === 'valid' ?
true :
false;
}
if ( true === $append ) {
$args['append'] = $this->_args['renderer']['append'];
}
if ( isset( $this->_args['renderer']['help'] ) ) {
$args['help'] = $this->_args['renderer']['help'];
}
if ( isset( $this->_args['renderer']['group-class'] ) ) {
$args['group_class'] = $this->_args['renderer']['group-class'];
}
if ( isset( $this->_args['checked'] ) && true === $this->_args['checked'] )
$args['input_args']['checked'] = $this->_args['checked'];
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/input.twig', $args, true );
if ( isset( $this->_args['type'] ) && 'hidden' === $this->_args['type'] ) {
$hidden = true;
} else {
$hidden = false;
}
return parent::render( $file->get_content(), $wrap, $hidden );
}
}

View File

@@ -0,0 +1,148 @@
<?php
/**
* Renderer of settings page select option.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Select extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$options = $this->_args['renderer']['options'];
if ( ! is_array( $options ) ) {
$callback = explode( ':', $options );
if ( ! isset( $callback[1] ) ) {
$options = $this->{$options}();
} else {
$value = $this->_args['value'];
if( false === is_array( $this->_args['value'] ) ){
$value = array( $this->_args['value'] );
}
try {
$options = $this->_registry->dispatch(
$callback[0],
$callback[1]
);
} catch (Ai1ec_Bootstrap_Exception $exc) {
return '';
}
}
}
$options = apply_filters( 'ai1ec_settings_select_options' , $options, $this->_args['id'] );
$fieldsets = array();
foreach ( $options as $key => &$option ) {
// if the key is a string, it's an optgroup
if ( is_string( $key ) ) {
foreach ( $option as &$opt ) {
$opt = $this->_set_selected_value( $opt );
}
} else {
$option = $this->_set_selected_value( $option );
if ( isset( $option['settings'] ) ) {
$fieldsets[] = $this->_render_fieldset(
$option['settings'],
$option['value'],
$this->_args['id'],
isset( $option['args']['selected'] )
);
}
}
}
$select_args = array();
$args = array(
'id' => $this->_args['id'],
'label' => $this->_args['renderer']['label'],
'attributes' => $select_args,
'options' => $options,
'fieldsets' => $fieldsets,
);
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/select.twig', $args, true );
return parent::render( $file->get_content(), $wrap, $hidden );
}
/**
* Toggle `selected` attribute according to current selection.
*
* @param array $option Option being checked.
*
* @return array Optionally modified option entry.
*/
protected function _set_selected_value( array $option ) {
if ( $option['value'] === $this->_args['value'] ) {
$option['args'] = array(
'selected' => 'selected',
);
}
return $option;
}
/**
* Gets the options for the "Starting day of week" select.
*
* @return array
*/
protected function get_weekdays() {
$locale = $this->_registry->get( 'p28n.wpml' );
$options = array();
for ( $day_index = 0; $day_index <= 6; $day_index++ ) {
$option = array(
'text' => $locale->get_weekday( $day_index ),
'value' => $day_index,
);
$options[] = $option;
}
return $options;
}
/**
* Renders fieldset with options for selected item.
*
* @param array $settings Settings structure.
* @param string $parent_id Option value from parent Html select element.
* @param string $select_id Html Select element id.
* @param bool $visible Whether fieldset is visible or not.
*
* @return string Html content.
*
* @throws Ai1ec_Bootstrap_Exception
*/
protected function _render_fieldset(
array $settings,
$parent_id,
$select_id,
$visible = false
) {
$setting_renderer = $this->_registry->get(
'html.element.setting-renderer'
);
$global_settings = $this->_registry->get(
'model.settings'
);
$content = '';
foreach ( $settings as $id => $setting ) {
$setting['id'] = $id;
// fetch value from real setting as this one is some kind of
// mockup.
$setting['value'] = $global_settings->get( $id );
$content .= $setting_renderer->render( $setting );
}
$args = array(
'parent_id' => $parent_id,
'contents' => $content,
'select_id' => $select_id,
'visible' => $visible,
);
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/select-fieldsets.twig', $args, true );
return parent::render( $file->get_content(), false );
}
}

View File

@@ -0,0 +1,98 @@
<?php
/**
* Renderer of settings page tags and categories option.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Tags_Categories extends Ai1ec_Html_Element_Settings {
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$tags = array();
$categories = array();
foreach ( array( 'tags', 'categories' ) as $type ) {
$options = array(
'taxonomy' => 'events_' . $type,
'hierarchical' => true,
);
${$type} = get_categories( $options );
}
if ( empty ( $tags ) && empty ( $categories ) ) {
return '';
}
$args = array(
'label' => $this->_args['renderer']['label'],
'help' => $this->_args['renderer']['help'],
);
$loader = $this->_registry->get( 'theme.loader' );
if ( ! empty ( $tags ) ) {
$args['tags'] = $this->_get_select_for_terms(
'tags',
Ai1ec_I18n::__( 'Tags' ),
$tags
);
}
$categories_html = '';
if ( ! empty ( $categories ) ) {
$args['categories'] = $this->_get_select_for_terms(
'categories',
Ai1ec_I18n::__( 'Categories' ),
$categories
);
}
return $loader->get_file( 'setting/tags-categories.twig', $args, true )
->get_content();
}
/**
* Creates the multiselect for tags and categories
*
* @param string $type
* @param string $label
* @param array $terms
*
* @return string The html for the select
*/
protected function _get_select_for_terms( $type, $label, array $terms ) {
$loader = $this->_registry->get( 'theme.loader' );
$options = array();
foreach ( $terms as $term ) {
$option = array(
'value' => $term->term_id,
'text' => $term->name,
);
if ( isset( $this->_args['value'][$type] ) ) {
if ( in_array( $term->term_id , $this->_args['value'][$type] ) ) {
$option['args'] = array(
'selected' => 'selected',
);
}
}
$options[] = $option;
}
$args = array(
'id' => $this->_args['id'] . '_default_' . $type,
'name' => $this->_args['id'] . '_default_' . $type . '[]',
'label' => $label,
'options' => $options,
'stacked' => true,
'attributes' => array(
'class' => 'ai1ec-form-control',
'multiple' => 'multiple',
// for Widget creator
'data-id' => 'tags' === $type ? 'tag_ids' : 'cat_ids',
),
);
return $loader->get_file( 'setting/select.twig', $args, true )
->get_content();
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Renderer of settings page textarea option.
*
* @author Time.ly Network, Inc.
* @instantiator new
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Html
*/
class Ai1ec_Html_Setting_Textarea extends Ai1ec_Html_Element_Settings {
const DEFAULT_ROWS = 6;
/* (non-PHPdoc)
* @see Ai1ec_Html_Element_Settings::render()
*/
public function render( $output = '', $wrap = true, $hidden = false ) {
$type = $this->_args['renderer']['type'];
$date = $append = false;
// Set attributes
$input_args = array();
// Set textarea rows
if ( ! empty( $this->_args['renderer']['rows'] ) ) {
$input_args['rows'] = $this->_args['renderer']['rows'];
}
// Set textarea disabled
if ( ! empty( $this->_args['renderer']['disabled'] ) ) {
$input_args['disabled'] = $this->_args['renderer']['disabled'];
}
// Set textarea readonly
if ( ! empty( $this->_args['renderer']['readonly'] ) ) {
$input_args['readonly'] = $this->_args['renderer']['readonly'];
}
$args = array(
'id' => $this->_args['id'],
'label' => $this->_args['renderer']['label'],
'input_args' => $input_args,
'value' => $this->_args['value'],
);
if ( true === $append ) {
$args['append'] = $this->_args['renderer']['append'];
}
if ( isset( $this->_args['renderer']['help'] ) ) {
$args['help'] = $this->_args['renderer']['help'];
}
$loader = $this->_registry->get( 'theme.loader' );
$file = $loader->get_file( 'setting/textarea.twig', $args, true );
return parent::render( $file->get_content(), $wrap, $hidden );
}
}