Most Popular
1500 questions
4
votes
1 answer
How can I pass a Craft Field into a JavaScript function?
I have a chart generated in script.
{
"country": "China",
"visits": 1882,
"color": "#FF6600"
},
This is what I want to do (and I know this is not correct).
{
"country": "{{ entry.country }}",
"visits": {{ entry.visits }},
…
Hellyar
- 921
- 8
- 21
4
votes
1 answer
Redactor image caption not saved and formatting lost
In Craft CMS 2.6.2945, I've added the "image" button in the Redactor config. In the editor, I've added an image and added a caption (by clicking the inserted image). When the image is saved, the caption shows up properly and I could see that it…
biko
- 670
- 3
- 16
4
votes
1 answer
Allow a User Group to access plugin pages (without hasCpSection)
I'm facing a problem which, on the surface, seems similar to this thread...
Like that other thread, I've found that a specific user group is unable to access my plugin's pages because the plugin is lacking a hasCpSection method. My plugin doesn't…
Lindsey D
- 23,974
- 5
- 53
- 110
4
votes
1 answer
Plugin fieldtype settings for ColumnType::LongText being inserted as varchar(255)
I’m working on a plugin that includes a custom fieldtype. Using Craft 2.6.2911, the fieldtype’s defineSettings looks like this:
public function defineSettings ( ) {
return [
'json_data' => [
AttributeType::String,
…
Sonja Leaf
- 43
- 5
4
votes
2 answers
Neo Children Output
I have a Neo Field: I want to work with blocks up to 3 levels deep.
My output code works fine:
{% nav block in entry.myField.level(1) %}
{% switch block.type.handle %}
{% case 'title' %}
{{ block.title }}
…
Design Frog
- 133
- 1
- 1
- 4
4
votes
3 answers
Setting Shipping Country and Method for the Cart screen
I want to set the default countryId and a default shipping method (there is only one shipping method but contain several rules), so that the cart screen shows this and we can then present a shipping cost. I then want to build a facility for the…
Terry Upton
- 1,894
- 10
- 28
4
votes
1 answer
Cannot remove index.php from URLs either
I am having the same issue as here: Another index.php?p= problem
I tried to post this as a comment rather than open another post but I don't have enough reputation...
I have tried all of the suggestions listed and none of them are working. Without…
ByteMyPixel
- 147
- 9
4
votes
1 answer
Simple template routes with plugins
I'm attempting to create a simple route that points to a template from a plugin. Note that I am attempting to create a page on the front-facing website, not the admin panel. Plugin (named: 'curious') is created with the following…
Jason
- 348
- 1
- 2
- 8
4
votes
2 answers
Is it possible to set any attributes (such as a class) of the `a` tag when using `getLink()`?
This code:
{{ foo.getLink() }}
Outputs this:
NAME_OF_PAGE
What I really want is something like:
NAME_OF_PAGE
Is it possible to set "class" and/or other html attributes when using Craft…
Beau Smith
- 143
- 4
4
votes
2 answers
How do I include record relationships in validation?
Say I have a record defining a foreign key relationship which is set to required, such as:
public function defineRelations()
{
return [
'type' => [
static::BELONGS_TO,
'Events_EventTypeRecord',
…
Jamie Pittock
- 1,511
- 11
- 15
4
votes
1 answer
The file does not appear to be an image. Bug?
I've installed the latest ImageMagick on my ubuntu 14 server. If I force imageDriver to use 'imagick', I can only upload Gif images. And if I force it to use GD, I can upload all images but only static gif images.
The images are not changed in any…
william
- 143
- 5
4
votes
1 answer
Is is possible to add a bespoke Twig template loader?
Twig lets you provide alternate (or multiple) template loaders. I'd like to take advantage of this to do use a bespoke loader to pull in components from a pattern library using a shorthand syntax like {% include '*mycomponent' %} or similar.
Does…
Mark Perkins
- 43
- 2
4
votes
2 answers
EmailService now has Twig render email messages in safe mode
EmailService now has Twig render email messages in safe mode.
-- https://craftcms.com/changelog#build2903
I don't think this is really a bug as it's intended behaviour, but this is causing me a pretty big issue because my email layout has code in…
Mike Pepper
- 4,391
- 17
- 26
4
votes
1 answer
Redirect entry type to another domain
I have an entry type (outsideCourse) that will never need its own page. It only exists so I can manipulate it in various lists of required courses. Thanks to Mats Mikkel Rummelhoff, I have a macro to plug its field attributes into a search URL for…
Katie Fritz
- 693
- 4
- 20
4
votes
1 answer
Reusing logic to set string variables
I would like to set some variables for every entry within a section ('courses'), and then use those variables in loops that are filtering by entry types and categories.
Some simplified markup:
Required Courses
-
{% for entry in…
Katie Fritz
- 693
- 4
- 20