Forums / Developer / Don't publish content with selection attribute value 'Select'

Don't publish content with selection attribute value 'Select'

Author Message

Romeo Antony

Sunday 19 December 2010 2:10:09 am

Hi all,

I wouldn't like to publish contents with selection attribute value "Select"

Contents will be only published if selection attribute value is something else.

So I need to edit the selection datatype's edit view file , to get this done.

Can anyone please help me further. Bez I am bit slow in catching ez API classes

Steven E. Bailey

Sunday 19 December 2010 3:11:07 am

Are you sure you just don't want to set this attribute to required which will reject any blank input?

If it really has to match and reject on some other value than blank (and you aren't setting the value and id of your dropdown to select are you - that would be an easy template fix) - then I would suggest creating another datatype to handle this instead of mucking around with the ezselection datatype.

If you REALLY must edit the ezselection type (i.e if you tons of existing ezselection types that have to follow these rules if they are edited), then look at kernel/classes/datatypes/ezselection/ezselectiontype.php at the validateObjectAttributeHTTPInput function. That would, I think, be the most logical place to add additional validation.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Romeo Antony

Sunday 19 December 2010 3:41:29 am

Thanks for the reply Steven.

"Are you sure you just don't want to set this attribute to required which will reject any blank input? "

I have set up selection attribute as required(single selection).

And values like as follows

Select

Value1

value 2

Value3

So always ezselection attribute value (Select) will be displayed when I start creating an object with selection atribute.

As you told , Steven I have put a optionvalue 1 as blank , means no value for option1

then option2, option3 ... .But when publish the content with selection attribute value as blank, it got publishsed even if it is required.

"(and you aren't setting the value and id of your dropdown to select are you - that would be an easy template fix)"

This only can select a specific option value will be selected . Right?.

For now , editing ezselection datatype is the solution, as you told me .

, just going to /ezselectiontype.php at the validateObjectAttributeHTTPInput function.

Thanks for the tip

Steven E. Bailey

Monday 20 December 2010 3:03:50 am

It doesn't make much sense to me to put the null value in the attribute. We mostly solve this by overriding the edit ezselection with something like this:

<option value=""> {"Select:"|i18n('design/whatever')}</option>

{foreach $attribute.class_content.options as $index}

<option value="{$Options.id}"> {$option-name[$index]}</option>

{/foreach}

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

eZ debug

Timing: Jan 30 2025 00:54:56
Script start
Timing: Jan 30 2025 00:54:56
Module start 'content'
Timing: Jan 30 2025 00:54:56
Module end 'content'
Timing: Jan 30 2025 00:54:56
Script end

Main resources:

Total runtime0.1393 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 588.1875180.8047
Module start 'content' 0.00620.0075 768.992298.2109
Module end 'content' 0.01370.1255 867.2031526.1875
Script end 0.1392  1,393.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.3976200.0002
Check MTime0.00130.9277200.0001
Mysql Total
Database connection0.00070.526210.0007
Mysqli_queries0.089664.34481410.0006
Looping result0.00100.68601390.0000
Template Total0.124889.610.1248
Template load0.00100.694910.0010
Template processing0.123888.885010.1238
Override
Cache load0.00070.468810.0007
Sytem overhead
Fetch class attribute can translate value0.00060.435810.0006
XML
Image XML parsing0.00020.140710.0002
General
dbfile0.01309.3658200.0007
String conversion0.00000.002930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs