I am trying to style the check symbol (✓) in my member profile tab on a Buddypress site. The tab is created in my functions.php file in my child theme shown in the code below. I want to make the check symbol green and bold. Because this is in PHP and part of a function I don't know how to accomplish this. Any ideas would be appreciated.
add_action('after_setup_theme','kleo_my_custom_tabs');
function kleo_my_custom_tabs()
{
global $bp_tabs;
$bp_tabs = array(); $bp_tabs['verify'] = array(
'type' => 'regular',
'name' => __('Verified ✓', 'kleo_framework'),
'group' => 'Verify',
'class' => 'regulartab'
);
}
Try this:
'Verified <b style=\'color:#009900;\'>✓</b>'
add_action('after_setup_theme','kleo_my_custom_tabs');
function kleo_my_custom_tabs()
{
global $bp_tabs;
$bp_tabs = array(); $bp_tabs['verify'] = array(
'type' => 'regular',
'name' => __('Verified <b style="color:green;">✓</b>', 'kleo_framework'),
'group' => 'Verify',
'class' => 'regulartab'
);
}
Related
I'm trying to add a new field to Admin Preferences - a textarea field with tinymce. I've added code to AdminPreferencesController.php:
$this->fields_options['contact'] = array(
'title' => $this->l('Contact'),
'icon' => 'icon-cogs',
'submit' => array('title' => $this->l('Save')),
);
$this->fields_options['contact']['fields']['PS_CONTACT_ADDITIONAL_INFO'] = array(
'type' => 'textarea',
'label' => $this->l('Short description'),
'name' => 'short_description',
'lang' => true,
'cols' => 60,
'rows' => 10,
'autoload_rte' => 'rte',
'col' => 6,
);
But tinymce doesnt' appear and when I'm using HTML tags after saving they disappear. Presta strips all HTML tags.
How to allow HTML tags on this field and enable tinymce?
It seems that you can't just add it in a regular way. But you can implement it in a next way.
First of all, use field type textareaLang instead of textarea and add a parameter 'validation' => 'isCleanHtml' to this field
$this->fields_options['contact']['fields']['PS_CONTACT_ADDITIONAL_INFO'] = array(
'type' => 'textareaLang',
'label' => $this->l('Short description'),
'name' => 'short_description',
'lang' => true,
'cols' => 60,
'rows' => 10,
'col' => 6,
'validation' => 'isCleanHtml'
);
Create your own script to initialize your editor. I created a script tinymce.init.js and put it to js/admin/ folder
$(document).ready(function(){
ad = ''; // this is defenition of the external plugin path. I didn't fint how it can impact on script if it's empty but by default it it the path to your admin folder
iso = iso_user;
var config = {
selector: '.textarea-autosize'
};
tinySetup(config);
});
Then include tinymce script and your own to this controller AdminPreferencesController.php
public function setMedia()
{
$this->context->controller->addJquery();
$this->context->controller->addJS(
array(
_PS_JS_DIR_.'admin/tinymce.init.js',
_PS_JS_DIR_.'tiny_mce/tiny_mce.js',
_PS_JS_DIR_.'admin/tinymce.inc.js'
)
);
parent::setMedia();
}
It should implement your requirements. But don't forget that now you should call your configuration field in multilingual scope. So, add a language id to Configuration::get() like
Configuration::get('PS_CONTACT_ADDITIONAL_INFO, $id_lang)
whenever you use it.
P.S. Bear in mind that the best solution for your goal is to create a simple module which will handle this. And far more, it is recommended way.
I am wanting to add a link to the Wordpress admin bar that will eventually purge all cache. At the moment I am trying to add the link to the admin bar but seem to be having problems.
I have followed a few methods I had found on Google, but for some reason I couldn't get them to work. (I don't know if this is due to the examples being outdated with the version of Wordpress?)
Here is what I am using so far:
function time_to_purge($wp_admin_bar) {
$args = array(
'id' => 'DaylesPurge',
'title' => 'Purge Cache',
'href' => '#',
'meta' => array(
'class' => 'DaylesPurge'
)
);
$wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'time_to_purge', 50);
function PurgeConfirmation() {
document.getElementById("PurgeConfirmation").innerHTML = "Are you sure you
wish to purge the cash?";
}
[EDIT]
Never-mind, this works perfectly. It was a matter of a simple spelling mistake in my code that was preventing it from displaying.
function time_to_purge($wp_admin_bar) {
$args = array(
'id' => 'DaylesPurge',
'title' => 'Purge Cache',
'href' => '#',
'meta' => array(
'class' => 'DaylesPurge'
)
);
$wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'time_to_purge', 50);
function PurgeConfirmation() {
document.getElementById("PurgeConfirmation").innerHTML = "Are you sure you
wish to purge the cash?";
}
I'm new to TYPO3 (first project) and I have some understanding issues of the creation of a custom element with a colorpicker. In this project I already have created a few elements but I only use predetermined fields for the backend input. For the element I need next I need the user to choose a color. I haven't found a fitting existing element. My setup that doesn't work is in the TCA/Overrides/tt_content.php file and looks like this.
$GLOBALS['TCA']['tt_content']['item_0']=array();
$GLOBALS['TCA']['tt_content']['item_0']['label']='Color';
$GLOBALS['TCA']['tt_content']['item_0']['config']=array();
$GLOBALS['TCA']['tt_content']['item_0']['config']['type']='input';
$GLOBALS['TCA']['tt_content']['item_0']['config']['renderType']='colorpicker';
$GLOBALS['TCA']['tt_content']['item_0']['config']['size']=10;
$GLOBALS['TCA']['tt_content']['types']['wo_mitem'] = array(
'showitem' => '--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.general;general,
header;Title,
subheader;Background,
header_link;Target,
item_0;Color,
bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css]
');
The item_0 was a try to create a colorpicker but it doesn't seem to work. Do I need something different in a different file? The first few lines I added to define my field. Is there a better way to do this?
All other files in my custom extension work (since all other custom elements work fine). The only difference is, as said, the need of a way to choose a color in the new one.
Just for a clearer look here the other files
setup.txt:
lib.contentElement {
templateRootPaths {
100 = EXT:wostyle/Resources/Private/Template
}
}
tt_content {
wo_mitem < lib.contentElement
wo_mitem {
templateName = MItem
}
}
tt_content.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
array(
'WO_Item (ItemBox, Text only)',
'wo_mitem',
'content-image'
),
'CType',
'wostyle'
);
$GLOBALS['TCA']['tt_content']['item_0']=array();
$GLOBALS['TCA']['tt_content']['item_0']['label']='Farbe';
$GLOBALS['TCA']['tt_content']['item_0']['config']=array();
$GLOBALS['TCA']['tt_content']['item_0']['config']['type']='input';
$GLOBALS['TCA']['tt_content']['item_0']['config']['renderType']='colorpicker';
$GLOBALS['TCA']['tt_content']['item_0']['config']['size']=10;
$GLOBALS['TCA']['tt_content']['types']['wo_mitem'] = array(
'showitem' => '--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.general;general,
header;Bezeichnung,
subheader;Chemische Bezeichnung,
header_link;Zielseite,
item_0;Farbe,
bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css]
');
typo.ts
mod.wizards.newContentElement.wizardItems.wo_extra {
header = WO Elemente
after = common
elements {
wo_mitem {
iconIdentifier = content-image
title = WO_Item (ItemBox, Text only)
description = Ein Produktfeld mit Text
tt_content_defValues {
CType = wo_mitem
}
}
}
show := addToList(wo_mitem)
}
MItem.html
<div class="item-text">
<f:link.typolink parameter="{data.header_link}">
<div class="item-front">
<f:if condition="{data.subheader}!=''">
<f:then>
<div class="item-bg">
<f:format.html>{data.subheader}</f:format.html>
</div>
</f:then>
</f:if>
<div class="item-title">
<f:format.html>{data.header}</f:format.html>
</div>
</div>
<div class="item-back">
<f:format.html>{data.bodytext}</f:format.html>
</div>
</f:link.typolink>
</div>
<f:debug>{data}</f:debug>
EDIT: I use typo3 8.7.8
I did not check your whole code but I have a working color-picker on a field ...
you're close but an error that pops up right away is that your item should be placed under ['columns'] ...
$GLOBALS['TCA']['tt_content']['columns']['item_0']=array();
next you are missing the refference to the wizard !! (you should adopt the annotation with square brackets which shows much more the structure)
this should be stored in Configuration/TCA/Overrides/tt_content.php: (when you override existing fields, otherwise you have a dedicated code for the element)
<?php
/***************
* Modify the tt_content TCA
*/
$tca = [
'columns' => [
'item_0' => [
'label' => 'Color',
'config' => [
'type' => 'input',
'size' => 10,
'eval' => 'trim',
'default' => '#ffffff',
'wizards' => [
'colorChoice' => [
'type' => 'colorbox',
'title' => 'LLL:EXT:lang/locallang_wizards:colorpicker_title',
'module' => [
'name' => 'wizard_colorpicker'
],
'dim' => '20x20',
'JSopenParams' => 'height=600,width=380,status=0,menubar=0,scrollbars=1',
],
],
],
],
],
];
$GLOBALS['TCA']['tt_content'] = array_replace_recursive($GLOBALS['TCA']['tt_content'], $tca);
With the help of webMan and some internet searches I could adopt my code a little.
I added the file "ext_tables.sql" with the content
CREATE TABLE tt_content (
item_0 varchar(10) DEFAULT '' NOT NULL,
);
And changed the tt_content.php in TCA/Overrides to:
$temporaryColumns = Array(
"item_0" => Array(
'label' => 'Color',
'config' => Array(
'type' => 'input',
'renderType' => 'colorpicker',
'size' => 10
)
)
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content',$temporaryColumns);
$GLOBALS['TCA']['tt_content']['types']['wo_mitem'] = array(
'showitem' => '--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.general;general,
header;Bezeichnung,
subheader;Chemische Bezeichnung,
header_link;Zielseite,
item_0;Farbe,
bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css]
');
There are still a view things missing in compare to webMans code but at least this is the first working version I have so i figured i show it since my question is answered:).
I need some data added default in the editor.
Like I want a template to get loaded in editor when I click on edit template option..
Can anyone suggest me some tip??
Here you can see how it can be done
$dataa= $this->getTemplate1();
$fieldset->addField('content', 'editor', array(
'name' => 'content',
'label' => Mage::helper('abandonedcart')->__('Content'),
'title' => Mage::helper('abandonedcart')->__('Content'),
'style' => 'width:700px; height:500px;',
'wysiwyg' => true,
'required' => true,
'state' => 'html',
'config' => $wysiwygConfig,
'value'=> $dataa,
));
if (Mage::getSingleton('adminhtml/session')->getAbandonedcartData()) {
$form->addValues(Mage::getSingleton('adminhtml/session')->getAbandonedcartData());
Mage::getSingleton('adminhtml/session')->setAbandonedcartData(null);
} elseif (Mage::registry('abandonedcart_data')) {
$form->addValues(Mage::registry('abandonedcart_data')->getData());
}
return parent::_prepareForm();
}
and calling a function to have data
public function getTemplate1() {
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('abandonedcart_abandonedcart_group_email_template');
$emailTemplate['template_text'];;
$template_id = Mage::getStoreConfig('abandonedcart/abandonedcart_group/email_template');
$emailTemplate = Mage::getModel('core/email_template')->loadDefault($template_id);
return $processedTemplate = $emailTemplate->getProcessedTemplate();
}
I'm new to Yii and i am facing issues with it. Hope some pros here can help me solve this. I bought a script online and i am editing it to my needs.
I want to have a text area with default texts. Example;
Name:
Age:
Sex:
what it is generating now:
<textarea class="span vertical medium" name="MAccount[accountInfo]" id="MAccount_accountInfo"></textarea>
what i want it to generate,or something like this :
<textarea class="span vertical medium" name="MAccount[accountInfo]" id="MAccount_accountInfo">Name: <br> Age: <br> Sex:</textarea>
something like above. But i only able to produce a textarea with blank/no content.below is my code,it is located inside a worklet.;
public function properties() {
$properties = array(
'elements' => array(
'accountInfo' => array(
'type' => 'textarea',
'class' => 'span vertical medium',
),
'email' => array(
'disabled' => true,
'append' => $this->model()->role == 'unverified' ? $this->t('unverified') : $this->t('verified'),
'hint' => $this->model()->role == 'unverified' ? $this->resendBtn() : '',
),
wm()->get('project.edit.buttons', array('step' => $this->step, 'projectId' => $this->project->id))->render('tools', array(), true),
),
'model' => $this->model(),
'class' => 'projectEditForm',
);
return $properties;
}
Default values are set in your model, not in your view. So you have to look in your model/ directory and locate the right model there. There you can add
public $accountInfo = "Name:\nAge:\nSex:";
<?php echo CHtml::activeTextArea($form,'abc',array('value'=>"12"));?>
$form->abc="Your text goes here"
it may help you