I am working on a Drupal site and I want to add a checkbox within a content type that will hide an object if checked.
I am not to worried about how to hide it, I can figure that out with Js or CSS later on but I need to know how to add a checkbox that has the ability to modify the display.
I think its going to be along the lines of adding a new field but I don't know what type of field to add.
Any help is greatly appreciated :)
I have done this by adding form alter,
You need to write the form alter then you can add states
property for the field you need to show or hide
$form['your_showhide_field']['#states'] = array(
'visible' => array(
':input[name="you_checkbox_name"]' => array('checked' => true),
),
);
OR
You can also use field condition state module to do this.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加