Available field types

There are multiple field types available to you when creating a block.
You can use the same field types for both Basic information and Repeatable entries tab.

 Text

Text input will be used as input field in generated block.
Additionally, in Tab: Repeatable entries, you can check one of the fields, to be used as title in each entry (in generated block, when adding/editing entries).

Code generated in view.php

        
                            <?php if (!empty($textFieldHandle)): ?>
    <?php echo h($textFieldHandle); ?>
<?php endif; ?>                    
    

Textarea

Textarea will be used as input field in generated block.
Every new line will be converted to <br/>.
You can set height of textarea.

Code generated in view.php

        
                            <?php if (!empty($textareaHandle)): ?>
    <?php echo nl2br(h($textareaHandle)); ?>
<?php endif; ?>                    
    

WYSIWYG Editor

Standard Concrete5 WYSIWYG Editor will be used as input field in generated block.
You can set height of WYSIWYG Editor.

Code generated in view.php

        
                            <?php if (!empty($wysiwygEditorHandle)): ?>
    <?php echo $wysiwygEditorHandle; ?>
<?php endif; ?>                    
    

Single Choice Field

Available types:

  • Default Select Field
  • Enhanced Select Field (using select2 for UI)
  • Radio List

There are two ways of adding select options:

  • enter every option in new line, e.g.
    Don't show
    Show
    Option keys will be numbers starting from 0
  • use double colon to specify key (value saved in database) and value (displayed text), e.g.
    no :: Don't show
    yes :: Show
    For keys only a-zA-Z0-9_ characters are permitted

Code generated in view.php

        
                            <?php if (!empty($selectFieldHandle)): ?>
    Key: <?php echo $selectFieldHandle; ?><br/>
    Value: <?php echo h($selectFieldHandle_options[$selecFieldHandle]); ?>
<?php endif; ?>                    
    

Multiple Choice Field

Available types:

  •   Default Multiselect Field
  •   Enhanced Multiselect Field (using select2 for UI)
  •   Checkbox List

There are two ways of adding select options:

  • enter every option in new line, e.g.
    Don't show
    Show
    Option keys will be numbers starting from 0
  • use double colon to specify key (value saved in database) and value (displayed text), e.g.
    no :: Don't show
    yes :: Show
    For keys only a-zA-Z0-9_ characters are permitted
        
                            <?php if (!empty($selectFieldHandle)): ?>
    Key: <?php echo $selectFieldHandle; ?><br/>
    Value: <?php echo h($selectFieldHandle_options[$selecFieldHandle]); ?>
<?php endif; ?>                    
    

"Link from Sitemap", "Link from File Manager" and "External Link" combined into one field.

Concrete5 page selector will be used as input field in generated block.

By default, only empty <a> tag will be generated in view.php + page selector in form.php.
Generating simple link is useful, when you need only url (e.g. text inside <a> and title attribute will be filled from other Text field) and you would like to use it in multiple places in your code.

Additional options:

  • Show "Custom string at the end of URL" field:
    Check it, when you sometimes want to add string at the end of URL - e.g. #contact-form or ?ccm_paging_p=2 etc.
  • Show "Text" field:
    Check it, when you want to add text between <a> tag
  • Show "Title" field:
    Check it, when you want to add title attribute

Code generated in view.php with no additional options selected

        
                            <?php if (!empty($linkFromSitemapHandle_link)): ?>
    <a href="<?php echo $linkFromSitemapHandle_link; ?>"></a>
<?php endif; ?>                    
    

Code generated in view.php with all additional options selected

        
                            <?php if (!empty($linkFromSitemapHandle_link)): ?>
    <a href="<?php echo $linkFromSitemapHandle_link; ?><?php echo $linkFromSitemapHandle_ending; ?>" title="<?php echo h($linkFromSitemapHandle_title); ?>">
        <?php echo h($linkFromSitemapHandle_text); ?>
    </a>
<?php endif; ?>                    
    

You can also access Page object in view.php and use all page methods available as you would use Page::getByID($linkFromSitemapHandle).

        
                            <?php 
// Get selected page name
$linkFromSitemapHandle_object->getCollectionName();

// Get attribute
$linkFromSitemapHandle_object->getAttribute('thumbnail');
?>                    
    

Code responsible for generating variables in view can be found in controller.php in prepareForViewLinkFromSitemap() method.

Feel free to modify it if necessary.

For example:
Create block type with Link to Sitemap field and all additional options checked. Install it and add block to your site. Now, if you don't fill Title field, $linkFromSitemapHandle_title will display Page Name.

Concrete5 file selector will be used as input field in generated block.

By default, only empty <a> tag will be generated in view.php + file selector in form.php.
Generating simple link is useful, when you need only url (e.g. text inside <a> and title attribute will be filled from other Text field) and you would like to use it in multiple places in your code.

Additional options:

  • Show "Text" field:
    Check it, when you need to add text between <a> tag
  • Show "Title" field:
    Check it, when you need to add title attribute

Code generated in view.php with no additional options selected

        
                            <?php if (!empty($linkFromFileManagerHandle_link)): ?>
    <a href="<?php echo $linkFromFileManagerHandle_link; ?>"></a>
<?php endif; ?>                    
    

Code generated in view.php with all additional options selected

        
                            <?php if (!empty($linkFromFileManagerHandle_link)): ?>
    <a href="<?php echo $linkFromFileManagerHandle_link; ?>" title="<?php echo h($linkFromFileManagerHandle_title); ?>">
        <?php echo h($linkFromFileManagerHandle_text); ?>
    </a>
<?php endif; ?>                    
    

You can also access File object in view.php and use all file methods available as you would use File::getByID($linkFromFileManagerHandle).

        
                            <?php 
// Get attribute
$linkFromFileManagerHandle_object->getAttribute('width');
?>                    
    

Code responsible for generating variables in view can be found in controller.php in prepareForViewLinkFromFileManager() method.

Feel free to modify it if necessary.

For example:
Create block type with Link from File Manager field and all additional options checked. Install it and add block to your site. Now, if you don't fill Title field, $linkFromSitemapHandle_title will display File Title/File Name.

Text input will be used as input field in generated block.

By default, only empty <a> tag will be generated in view.php + file selector in form.php.
Generating simple link is useful, when you need only url (e.g. text inside <a> and title attribute will be filled from other Text field) and you would like to use it in multiple places in your code.

Additional options:

  • Show "Text" field:
    Check it, when you want to add text between <a> tag
  • Show "Title" field:
    Check it, when you want to add title attribute

Code generated in view.php with no additional options selected:

        
                            <?php if (!empty($externalLinkHandle)): ?>
    <a href="<?php if ($externalLinkHandle_protocol!='other'): ?><?php echo $externalLinkHandle_protocol; ?><?php endif; ?><?php echo $externalLinkHandle; ?>"></a>
<?php endif; ?>                    
    

Code generated in view.php with all additional options selected:

        
                            <?php if (!empty($externalLinkHandle)): ?>
    <a href="<?php if ($externalLinkHandle_protocol!='other'): ?><?php echo $externalLinkHandle_protocol; ?><?php endif; ?><?php echo $externalLinkHandle; ?>" title="<?php echo h($externalLinkHandle_title); ?>">
        <?php echo h($externalLinkHandle_text); ?>
    </a>
<?php endif; ?>                    
    

Code responsible for generating variables in view can be found in controller.php in prepareForViewExternalLink() method.

Feel free to modify it if necessary.

For example:
Create block type with External link field and all additional options checked. Install it and add block to your site. Now, if you don't fill Title field, $externalLinkHandle_title will display nothing.

Image

Concrete5 file selector will be used as input field in generated block.

By default, only one  <img> tag (with link to original file as src attribute and File Title/File Name as alt attribute) will be generated in view.php + file selector in form.php.

Additional options:

  • Show "Alt text" field:
    Check it, when you need custom alt attribute, otherwise File Title/File name will be displayed.
  • Generate thumbnail using image helper
    Check it, when you need smaller version image (e.g. to use as thumbnail).
    Thumbnail will be generated by c5 image helper. If original image is smaller than specified dimensions - original image will be used instead.
    Provide width or height. If you check Crop option you will need to provide both.
  • Generate fullscreen image using image helper:
    when you need bigger image to use for example as a lightbox image. Fullscreen image will be generated based on selected image file, If original image is bigger than specified dimensions.
    Provide width or height. If you check Crop option you will need to provide both dimensions.

Code generated in view.php with no additional options selected

        
                            <?php if (!empty($imageHandle_link)): ?>
    <?php // Original image ?>
    <img src="<?php echo $imageHandle_link; ?>" alt="<?php echo h($imageHandle_alt); ?>" width="<?php echo $imageHandle_width; ?>" height="<?php echo $imageHandle_height; ?>" />
<?php endif; ?>                    
    

Code generated in view.php with all additional options selected

        
                            <?php if (!empty($imageHandle_link)): ?>
    <?php // Original image ?>
    <img src="<?php echo $imageHandle_link; ?>" alt="<?php echo h($imageHandle_alt); ?>" width="<?php echo $imageHandle_width; ?>" height="<?php echo $imageHandle_height; ?>" />
<?php endif; ?>

<?php if (!empty($imageHandle_fullscreenLink)): ?>
    <?php // Fullscreen image ?>
    <img src="<?php echo $imageHandle_fullscreenLink; ?>" alt="<?php echo h($imageHandle_alt); ?>" width="<?php echo $imageHandle_fullscreenWidth; ?>" height="<?php echo $imageHandle_fullscreenHeight; ?>" />
<?php endif; ?>

<?php if (!empty($imageHandle_thumbnailLink)): ?>
    <?php // Thumbnail image ?>
    <img src="<?php echo $imageHandle_thumbnailLink; ?>" alt="<?php echo h($imageHandle_alt); ?>" width="<?php echo $imageHandle_thumbnailWidth; ?>" height="<?php echo $imageHandle_thumbnailHeight; ?>" />
<?php endif; ?>                    
    

Code responsible for generating variables in view can be found in controller.php in prepareForViewImage() method.

Feel free to modify it if necessary.

For example:
Create block type with Image field and all additional options checked. Install it and add block to your site. Now, if you don't fill Alt text field, $imageHandle_alt will display "File Title/File Name".

Express

Example code (how to display data from Express) will be generated view.php.

File Set

Example code (how to display data from File Set) will be generated view.php.

HTML Editor

HTML Editor will be used as input field in generated block.

You can set height of HTML Editor.

Code generated in view.php

        
                            <?php if (!empty($htmlEditorHandle)): ?>
    <?php echo $htmlEditorHandle; ?>
<?php endif; ?>                    
    

Date Picker

Concrete5 date picker will be used as input field in generated block.