In-line Editing of fuel variables
I've got one page and one block uploaded into the CMS. I'm using site variables for a few of the paragraphs and headings. So far it's all working, except the in-line-editing of those site variables. When the pencil icon is clicked, instead of allowing me to edit the variable, I get the error: "This variable must either be saved in the admin or edited in the associated views/_variables file." Does anyone know what might cause this error? (the pencil for editing the body of the page is the only one that works) Thanks!
Comments
<?=fuel_var('myvar', 'default', 'sitevariables')?>
Note the 3rd parameter specifying to use sitevariables instead of pagevariables
I'm not using using any of the optional variables. the variables are defined in the pagevariables section of the CMS only.
<?=fuel_var('myvar', 'default', 'sitevariables')?>
My fuel_mode is set to auto.
If I specify 'sitevariables' in the third parameter I get...
*** http://localhost:3000/fuel/sitevariables/inline_edit/ - 404 Page Not Found
<?php echo fuel_var('homeInsuranceTelephone','','sitevariables');?>
If the third parameter is 'pagevariables' I get...
"This variable must either be saved in the admin or edited in the associated views/_variables file."
<?php echo fuel_var('heading','','pagevariables'); ?>
The heading variable is clearly defined in MY_fuel_layouts.php:
$config['layouts']['home-insurance-page'] = array(
'fields' => array(
'Header' => array('type' => 'fieldset', 'label' => 'Header', 'class' => 'tab'),
'page_title' => array('label' => lang('layout_field_page_title')),
'meta_description' => array('label' => lang('layout_field_meta_description')),
'opengraph_image' => array('label' => lang('layout_field_opengraph_image')),
'meta_keywords' => array('label' => lang('layout_field_meta_keywords')),
'introbanner_alttext' => array('label' => 'Intro Banner SEO Text (leave blank for H1 Heading)', 'type' => 'string'),
'Body' => array('type' => 'fieldset', 'label' => 'Body', 'class' => 'tab'),
'heading' => array('label' => lang('layout_field_heading')),
'heading2' => array('label' => 'Sub Heading (H2)', 'type' => 'string'),
'body' => array('label' => lang('layout_field_body'), 'type' => 'textarea', 'description' => lang('layout_field_body_description')),
'body_class' => array('label' => lang('layout_field_body_class')),
'testimonial_block' => array('label' => 'Testimonial Block Visible', 'value' => 'yes', 'type' => 'enum', 'mode' => 'radios', 'options' => array( 'yes' => 'yes', 'no' => 'no') ),
)
);
And of course it's writing to the page correctly!
Just logged at the console output...
jquery-3.2.1.min.js?c=:2 Uncaught TypeError: $this.filter(...).size is not a function
at HTMLSpanElement. (fuel_inline.min.js?c=:81)
at Function.each (jquery-3.2.1.min.js?c=:2)
at e.fn.init.each (jquery-3.2.1.min.js?c=:2)
at moveMarkers (fuel_inline.min.js?c=:81)
at refresh (fuel_inline.min.js?c=:80)
at showEditors (fuel_inline.min.js?c=:90)
at toggleEditors (fuel_inline.min.js?c=:90)
at initFUELBar (fuel_inline.min.js?c=:96)
at init (fuel_inline.min.js?c=:74)
at HTMLDocument. (fuel_inline.min.js?c=:96)
.....
in modules/fuel/assets/js/fuel/fuel_inline.min.js
At line 82 you make use of the .size method which has been deprecated since jQuery 1.8. I replaced this with:
if($this.filter(":hidden").length!=0)
This solved the problem of errors in console output but it did not solve my particular problem with inline editing.
https://api.jquery.com/size/
public function inline_edit($field = NULL, $page_id = NULL)
If I paste the below code within the true branch of ! is_numeric($field))... both the function arguments are empty
echo "field = " . $field . "
";
echo "page_id = " . $page_id . "
";
die();
Therefore making the values going into the $where = array('name' => '', 'page_id' => $page_id) empty.