本文整理汇总了PHP中HtmlEditorField类的典型用法代码示例。如果您正苦于以下问题:PHP HtmlEditorField类的具体用法?PHP HtmlEditorField怎么用?PHP HtmlEditorField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HtmlEditorField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
/**
* Setup the CMS Fields for the User Defined Form
*
* @return FieldSet
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
// define tabs
$fields->findOrMakeTab('Root.Form', _t('UserDefinedForm.FORM', 'Form'));
$fields->findOrMakeTab('Root.Options', _t('UserDefinedForm.OPTIONS', 'Options'));
$fields->findOrMakeTab('Root.EmailRecipients', _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'));
$fields->findOrMakeTab('Root.OnComplete', _t('UserDefinedForm.ONCOMPLETE', 'On Complete'));
$fields->findOrMakeTab('Root.Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions'));
// field editor
$fields->addFieldToTab("Root.Form", new FieldEditor("Fields", 'Fields', "", $this));
// view the submissions
$fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', "Disable Saving Submissions to Server")));
$fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField("Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this));
UserDefinedForm_EmailRecipient::$summary_fields = array('EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From'));
// who do we email on submission
$emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
$fields->addFieldToTab("Root.EmailRecipients", $emailRecipients);
// text to show on complete
$onCompleteFieldSet = new FieldList($editor = new HtmlEditorField("OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'), _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage)));
$editor->setRows(3);
$fields->addFieldsToTab("Root.OnComplete", $onCompleteFieldSet);
$fields->addFieldsToTab("Root.Options", $this->getFormOptions());
return $fields;
}
示例2: __construct
function __construct($controller, $name, $speakerID, $use_actions = true)
{
$fields = new FieldList();
//point of contact
$speakerIDfield = new HiddenField('speaker_id');
$speakerIDfield->setValue($speakerID);
$fields->push($speakerIDfield);
$fields->push(new TextField('org_name', 'Name of Organizer'));
$fields->push(new EmailField('org_email', 'Email'));
$fields->push(new TextField('event_name', 'Event'));
$fields->push(new TextField('event_format', 'Format/Length'));
$fields->push(new TextField('event_attendance', 'Expected Attendance (number)'));
$fields->push(new TextField('event_date', 'Date of Event'));
$fields->push(new TextField('event_location', 'Location'));
$fields->push(new TextField('event_topic', 'Topic(s)'));
$request = new HtmlEditorField('general_request', 'General Request');
$request->setRows(10);
$fields->push($request);
$sec_field = new TextField('field_98438688', 'field_98438688');
$sec_field->addExtraClass('honey');
$fields->push($sec_field);
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('sendSpeakerEmail', 'Send'));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('PageBuilder');
/* =========================================
* Images
=========================================*/
$fields->addFieldToTab('Root.Main', new UploadField('Image'), 'Content');
/* =========================================
* Menu Item Details
=========================================*/
$fields->addFieldToTab('Root.Main', $price = new CurrencyField('Price'), 'Content');
$price->setRightTitle('To add extra price options e.g Small, Large please add a variation under the "Variations" tab above');
$fields->addFieldToTab('Root.Main', $ingredients = new HtmlEditorField('Ingredients'), 'Metadata');
$ingredients->setRows(15);
/* =========================================
* Variations
=========================================*/
$config = GridFieldConfig_RelationEditor::create(10);
$config->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent(new GridFieldDeleteAction());
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'Price' => 'Price'));
$gridField = new GridField('Variations', 'Variations', $this->owner->MenuVariations(), $config);
$fields->addFieldToTab('Root.Variations', $gridField);
return $fields;
}
示例4: getCMSFields
public function getCMSFields()
{
$oFieldExternalLink = new TextField('LinkExternalUrl', 'Externe link (opent in nieuw venster, begin met http://)', $this->LinkExternalUrl);
$name = $oFieldExternalLink->getName();
$name = preg_replace("/([A-Za-z0-9\\-_]+)/", "Widget[" . $this->ID . "][\\1]", $name);
$oFieldExternalLink->setName($name);
$oFieldInternalLink = new SimpleTreeDropdownField('InternalUrlID', 'Interne link', 'SiteTree', $this->InternalUrlID, null, 'Kies een pagina');
$name = $oFieldInternalLink->getName();
$name = preg_replace("/([A-Za-z0-9\\-_]+)/", "Widget[" . $this->ID . "][\\1]", $name);
$oFieldInternalLink->setName($name);
$aSelectionGroupItems = array(new SelectionGroup_Item('none', new LiteralField('nolink', ''), 'Geen link'), new SelectionGroup_Item('internal', $oFieldInternalLink, 'Interne link'), new SelectionGroup_Item('external', $oFieldExternalLink, 'Externe link'));
$fldSelectionGroup = new SelectionGroup('LinkType', $aSelectionGroupItems);
// config htmleditor
// make a new TinyMCE config called "footer" by copying the default ("cms") config
/*
$footerConfig = CustomHtmlEditorConfig::copy('simpletoolbar', 'cms');
$footerConfig->setButtonsForLine(3, array());
$footerConfig->setButtonsForLine(2, array());
*/
$oFields = new FieldList(new TextField('Header', 'Titel'), $fldBody = new HtmlEditorField('Body', 'Inhoud'), new HeaderField('hdrLink', 'Link', 3), new TextField('LinkTxt', 'Tekst link'), $fldSelectionGroup);
$fldBody->setRows(6);
// assign the "footer" TinyMCE config to this field
$fldBody->setEditorConfig('simpletoolbar');
// set the editor's body class. This will make it class="typography footer-content"
$fldBody->setBodyClass('widget_text typograhy');
return $oFields;
}
示例5: __construct
function __construct($controller, $name, $company)
{
// Define fields //////////////////////////////////////
if ($company->canEditProfile()) {
$fields = new FieldList(new TextField('Name', 'Company Name'), new TextField('URL', 'Company Web Address (URL)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), $big_logo = new FileAttachmentField('BigLogo', 'Large Company Logo'), $small_logo = new FileAttachmentField('Logo', 'Small Company Logo'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new TextField('Industry', 'Industry (less than 4 Words)'), $desc = new HtmlEditorField('Description', 'Company Description'), new LiteralField('Break', '<p></p>'), $contrib = new HtmlEditorField('Contributions', 'How you are contributing to OpenStack (less than 150 words)'), new LiteralField('Break', '<p></p>'), $products = new HtmlEditorField('Products', 'Products/Services Related to OpenStack (less than 100 words)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<p></p>'), new ColorField("Color", "Company Color"), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new TextField('ContactEmail', 'Best Contact email address (optional)'), new LiteralField('Break', '<p>This email address will be displayed on your profile and may be different than your own address.'));
$desc->addExtraClass("company-description");
$contrib->addExtraClass("company-contributions");
$products->addExtraClass("company-products");
$big_logo_validator = new Upload_Image_Validator();
$big_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
$big_logo_validator->setAllowedMaxImageWidth(500);
$big_logo->setAcceptedFiles(array('jpg', 'png', 'jpeg'));
$big_logo->setView('grid');
$big_logo->setFolderName('companies/main_logo');
$big_logo->setValidator($big_logo_validator);
$small_logo_validator = new Upload_Image_Validator();
$small_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
$small_logo_validator->setAllowedMaxImageWidth(200);
$small_logo->setAcceptedFiles(array('jpg', 'png', 'jpeg'));
$small_logo->setView('grid');
$small_logo->setFolderName('companies/main_logo');
$small_logo->setValidator($small_logo_validator);
} else {
if ($company->canEditLogo()) {
$fields = new FieldList(new ReadonlyField('Name', 'Company Name'), new ReadonlyField('URL', 'Company Web Address (URL)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new CustomUploadField('BigLogo', 'Large Company Logo'), new CustomUploadField('Logo', 'Small Company Logo'));
}
}
$actionButton = new FormAction('save', 'Save Changes');
//$actionButton->addExtraClass('btn green-btn');
$actions = new FieldList($actionButton);
parent::__construct($controller, $name, $fields, $actions);
}
示例6: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
/* -----------------------------------------
* Color Picker
------------------------------------------*/
Requirements::css('boilerplate/css/colorpicker.css');
Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
/* =========================================
* Settings
=========================================*/
if (!$fields->fieldByName('Root.Settings')) {
$fields->addFieldToTab('Root', new TabSet('Settings'));
}
/* -----------------------------------------
* Images
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Images', 'Images');
$fields->addFieldsToTab('Root.Settings.Images', array($logo = new UploadField('LogoImage', _t('BoilerplateConfig.LogoImageLabel', 'Logo')), $favicon = new UploadField('Favicon', _t('BoilerplateConfig.FaviconLabel', 'Favicon'))));
$logo->setRightTitle('Choose an Image For Your Logo');
$favicon->setRightTitle('Choose an Image For Your Favicon (16x16)');
/* -----------------------------------------
* Company Details
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Details', 'Details');
$fields->addFieldsToTab('Root.Settings.Details', array(new Textfield('Phone', _t('BoilerplateConfig.PhoneLabel', 'Phone Number')), new Textfield('Email', _t('BoilerplateConfig.EmailLabel', 'Public Email Address')), $PhysicalAddress = new HtmlEditorField('PhysicalAddress', _t('BoilerplateConfig.PhysicalAddressLabel', 'Physical Address'))));
$PhysicalAddress->setRows(3);
/* -----------------------------------------
* Tracking Code
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.TrackingCode', 'Tracking Code');
$fields->addFieldsToTab('Root.Settings.TrackingCode', array($trackingCode = new TextareaField('TrackingCode', _t('BoilerplateConfig.TrackingCodeLabel', 'Tracking Code'))));
$trackingCode->setRows(20);
}
示例7: testSavingLinksWithoutHref
public function testSavingLinksWithoutHref()
{
$obj = $this->objFromFixture('HtmlEditorFieldTest_Object', 'home');
$editor = new HtmlEditorField('Content');
$editor->setValue('<p><a name="example-anchor"></a></p>');
$editor->saveInto($obj);
$this->assertEquals('<p><a name="example-anchor"></a></p>', $obj->Content, 'Saving a link without a href attribute works');
}
示例8: getCMSFields
function getCMSFields()
{
$fields = FieldList::create(TabSet::create('Root'));
$fields->addFieldToTab('Root.Main', new UploadField('Image'));
$fields->addFieldToTab('Root.Main', $caption = new HtmlEditorField('Caption'));
$caption->setRows(15);
return $fields;
}
示例9: updateCMSFields
function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root.Resourses', $he = new HtmlEditorField("ResoursesContent", "Content"));
$he->setRows(7);
$options = $this->owner->Resourses();
$gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(10), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldSortableRows('SortOrder'));
$itemsTable = new GridField("Resourses", "Resourses", $options, $gridFieldConfig);
$fields->addFieldToTab('Root.Resourses', $itemsTable);
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertAfter($submitted = new HtmlEditorField('AfterSubmissionContent'), 'Content');
$submitted->setRows(20);
$submitted->setRightTitle('Displayed after a user submits a game for approval');
$fields->insertAfter($loggedOut = new HtmlEditorField('LoggedOutMessage'), 'Content');
$loggedOut->setRows(20);
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Name');
$fields->removeByName('OwnerID');
$fields->removeByName('ParentID');
$fields->addFieldToTab('Root.Main', $caption = new HtmlEditorField('Caption'));
$caption->setRows(5);
$fields->addFieldToTab('Root.Main', new TextField('SortOrder'));
return $fields;
}
示例12: testBrokenLinkHighlighting
public function testBrokenLinkHighlighting()
{
$sitetree = new SiteTree();
$editor = new HtmlEditorField('Content');
$editor->setValue('<a href="[sitetree_link id=0]">Broken Link</a>');
$element = new SimpleXMLElement(html_entity_decode((string) new SimpleXMLElement($editor->Field())));
$this->assertContains('ss-broken', (string) $element['class'], 'A broken link class is added to broken links');
$editor->setValue(sprintf('<a href="[sitetree_link id=%d]">Working Link</a>', $this->idFromFixture('SiteTree', 'home')));
$element = new SimpleXMLElement(html_entity_decode((string) new SimpleXMLElement($editor->Field())));
$this->assertNotContains('ss-broken', (string) $element['class']);
}
示例13: __construct
function __construct($controller, $name, $use_actions = true)
{
$fields = new FieldList();
//point of contact
$fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name'));
$fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email'));
//main info
$fields->push($title = new TextField('title', 'Title'));
$fields->push($url = new TextField('url', 'Url'));
$fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?'));
$fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type")));
$ddl_type->setEmptyString("--SELECT A JOB TYPE --");
$fields->push($description = new HtmlEditorField('description', 'Description'));
$fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
$fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
$fields->push($company = new CompanyField('company', 'Company'));
$point_of_contact_name->addExtraClass('job_control');
$point_of_contact_email->addExtraClass('job_control');
$title->addExtraClass('job_control');
$url->addExtraClass('job_control');
$description->addExtraClass('job_control');
$instructions->addExtraClass('job_control');
$expiration_date->addExtraClass('job_control');
$company->addExtraClass('job_control');
//location
$ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
$ddl_locations->addExtraClass('location_type');
$ddl_locations->addExtraClass('job_control');
$fields->push($ddl_locations);
$fields->push($city = new TextField('city', 'City'));
$fields->push($state = new TextField('state', 'State'));
$fields->push($country = new CountryDropdownField('country', 'Country'));
$city->addExtraClass('physical_location');
$state->addExtraClass('physical_location');
$country->addExtraClass('physical_location');
// Guard against automated spam registrations by optionally adding a field
// that is supposed to stay blank (and is hidden from most humans).
// The label and field name are intentionally common ("username"),
// as most spam bots won't resist filling it out. The actual username field
// on the forum is called "Nickname".
$fields->push(new TextField('user_name', 'UserName'));
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('saveJobRegistrationRequest', 'Save'));
}
// Create validators
$validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]);
$this->addExtraClass('job-registration-form');
$this->addExtraClass('input-form');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例14: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->push(TextField::create("Title"));
$fields->push(HtmlEditorField::create("HTML", "Content"));
return $fields;
}
示例15: getCMSFields
public function getCMSFields()
{
Requirements::css('widgetify/css/widgetify_cms.css');
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
Requirements::javascript('widgetify/scripts/widgetify_page.js');
$fields = parent::getCMSFields();
$fields->push(HiddenField::create('WidgetifyContent', 'WidgetifyContent'));
$fields->push(HiddenField::create('ThisID', 'ThisID', $this->ID));
$tab = $fields->findOrMakeTab('Root.Main');
$tab->insertAfter(HeaderField::create('WidgetifyTitle', 'Widgetify Template', 3), 'Metadata');
if (!$this->WidgetifyTemplateID) {
$this->WidgetifyTemplateID = 0;
}
$templatesMap = DataList::create('WidgetifyTemplate')->map();
$tab->insertAfter(DropdownField::create('WidgetifyTemplateID', 'Select Template', $templatesMap)->setEmptyString('- Select -'), 'WidgetifyTitle');
$tab->insertAfter(CheckboxField::create('CSSFrontend', 'Apply template Stylesheet to front-end page'), 'WidgetifyTemplateID');
$tab->insertAfter(CheckboxField::create('JSFrontend', 'Apply template Javascript to front-end page'), 'CSSFrontend');
$tab->insertAfter(HeaderField::create('WidgetifyPreviewTitle', 'Widgetify Content', 3), 'JSFrontend');
$tab->insertAfter(LiteralField::create('WidgetifyPreview', '<div id="widgetifyPreview" class="widgetifyTemplate"></div>'), 'WidgetifyPreviewTitle');
$htmlField = HtmlEditorField::create('WidgetDynamicContent', false);
$editorFieldContents = '
<div id="WidgetDynamicContentHolder" class="WidgetDynamicContentHolder">
<p id="edit-widget-title">Edit content</p>' . $htmlField->forTemplate() . '
<p class="widget-edit-actions">
<a href="javascript:;" id="save-widget-content" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary">Update</a>
<a href="javascript:;" id="cancel-widget-content" class="ss-ui-action-destructive ui-button ui-widget ui-state-default ui-button-text-icon-primary ui-corner-left ss-ui-button">Cancel</a>
</p>
</div>';
$tab->insertAfter(LiteralField::create('WidgetDynamicContentPlaceHolder', $editorFieldContents), 'WidgetifyPreview');
$fields->removeFieldFromTab('Root.Main', 'Content');
return $fields;
}