Call the default value from blueprint

largeSize2:
label: Responsive Large - (Default 4)
type: number
default: 11
min: 1
max: 12

That’s my Yaml. The problem. There seems to be an issue. If someone deletes the default value out of the panel. Then it doesn’t regenerate in the pannel and saves it to nothing. Then it bugs out.

If it wouldn’t allow null and would put the number back in the panel that would be ideal.

But if it won’t then I need to be able to call that default value and return the number in an if statement. I can write the if statement I just need to know how to call it.

Thanks

Brandon

You want to add required: true.

largesize2:
  label: Responsive Large
  type: number
  required: true
  default: 11
  placeholder: 4
  min: 1
  max: 12
  help: Default is 4.
1 Like

what’s the point in a default if there is a placeholder?

2 different things.

‘Placeholder’ just shows a greyed-out value when the user deletes all values from the field - a ‘guide’ to the user, showing an example of what should be there. ‘Default’ actively enters a default value.

What’s crazy though, is that on refresh if null the default doesn’t come back, it sets the value as nothing.

Because the page is remembering what your user just entered: nothing. It hasn’t saved it yet, though. So if required is there, it won’t let your user save it with the field empty.

If you don’t want to allow the user to leave a certain field empty, you should always mark it as required.

1 Like

This is how I solved it.

if ($childMenu == '1' || $magellanMenu == '1' || $siblingMenu == '1' ){
$sOff = "1";
$mOff = "1";
$lOff = "3";
$xLOff = "3";
$sSize = "12";
$mSize = "6";
$lSize = "4";
$xLSize = "4";

}

else{
$sOff = "0";
$mOff = "0";
$lOff = "4";
$xLOff = "4";
$sSize = "12";
$mSize = "10";
$lSize = "8";
$xLSize = "8";
}


 snippet('core/pagesize',array(

    'sOff' => $sOff,
    'mOff' => $mOff,
    'lOff' => $lOff,
    'xLOff' => $xLOff,
    'sSize' => $sSize,
    'mSize' => $mSize,
    'lSize' => $lSize,
    'xLSize' => $xLSize

)
)

 ?>

Then the snippet

<?php


if ($page->smallOffset()->isNotEmpty()) {
    $smallOffset = $page->smallOffset();
} else {
    $smallOffset = $sOff;
}
if ($page->mediumOffSet()->isNotEmpty()) {
    $mediumOffset = $page->mediumOffset();
} else {
    $mediumOffset = $mOff;
}
if ($page->xLargeOffset()->isNotEmpty()) {
    $xlargeOffset = $page->xLargeOffset();
} else {
    $xlargeOffset = $xLOff;
}
if ($page->largeOffset()->isNotEmpty()) {
    $largeOffset = $page->largeOffset();
} else {
    $largeOffset =  $lOff ;
}
?>


<?php
if ($page->smallSize()->isNotEmpty()) {
    $smallSize = $page->smallSize();
} else {
    $smallSize = 12;
}
if ($page->mediumSize()->isNotEmpty()) {
    $mediumSize = $page->mediumSize();
} else {
    $mediumSize = $mSize;
}
if ($page->xLargeSize()->isNotEmpty()) {
    $xlargeSize = $page->largeSize();
} else {
    $xlargeSize = $xLSize;
}
if ($page->largeSize()->isNotEmpty()) {
    $largeSize = $page->largeSize();
} else {
    $largeSize = $lSize;
}
?>
<div class="cell small-<?= $smallSize ?> medium-<?= $mediumSize ?> large-<?= $largeSize ?> xlarge-<?= $xlargeSize ?> x-large-offset-<?= $xlargeOffset ?> large-offset-<?= $largeOffset ?>  medium-offset-<?= $mediumOffset ?> small-offset-<?= $smallOffset ?>  text2" id="text2">

I don’t want to wait for deploys to be able to make layout changes. This uses foundation 6. If anyones curious. :slight_smile:

Not wanting to wait for deploys is why I wrote this script to manipulate layouts.