Download the PHP package mvrk/icenberg without Composer

On this page you can find all versions of the php package mvrk/icenberg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package icenberg

Icenberg 🥶

What is it?

This requires ACF Pro and is primarily for internal use at Maverick, although it is easy to implement on any WordPress template using ACF's Flexible content fields.

Icenberg is an attempt to clean up ACF Flexible content block templates which often involve a lot of repetition and logic tangled up in presentation, in true WordPress style.

Using Icenberg's methods we can render any acf fields complete with BEM classes and settings in a clean(er) OO fashion, while still allowing us to do things the old fashioned way if necessary.

It is designed to be used primarily with flexible content fields as it asumes the existance of 'the row' but could also work within non-flexible groups and repeaters, in theory.

Note: The buttons and settings methods rely on Maverick specific setups, we'll make these more generally usable in the future.

Getting Started

Install via composer:

make sure autoloading is set up in functions.php - something like:

Make sure you have ACF Pro installed. The library also supports ACF Gravity forms plugin.

The following all takes place inside ACF's the_row() - ie:

Initialise with ACFs the_row_layout()

Once that's intialised you're ready to build your block.

Icenberg Methods

get_element($field_name, $tag = 'div')

Returns an ACF field as a formatted string, wrapped up in all the divs you need and with any special considerations applied. Takes the field name as an argument and optionally a tag for the uppermost element. If no tag is set it will use 'div'

the_element($field_name, $tag = 'div')

As above, but echoes it out immediately.

Icenberg is smart enough to know what a field's type is, so you don't need to differentiate, you just pass the field name in.

enclose()

Enclose is a utility for wrapping multiple icenberg fields in a container div without having to use a ?> anywhere. You just need to pass it a classname (without prefixes as these will be applied by icenberg). So clean!

So for example, in a 'Cta' block, where cta_heading is a text field and cta_content is a wysiwyg field:

will generate:

You could also pass any thing else you like to enclose as part of the array, as long as its storable as a variable (for example inserting a get_template_part() won't work here because it effectively prints the content).

Of course life is never simple, so you will most likely need more complex layouts, but icenberg doesn't mind. You can insert it in html if you want to.

settings($field_name, $additional_classes)

Pass in a field group of settings and optionally an array of manually set classes and it will attach them as CSS modifier classes. if you include a text field called 'unique_id' in your group icenberg will attach it as a id too.

Example using settings in enclose():

or in regular php/html

which will print out something like

Depending on the settings in your group.

Conditionals

field($field_name)

you can use icenberg to evaluate fields too, using the field() method in conjucntion with the below methods. field() takes the field name as an argument and returns the icenberg instance for method chaining.

is($value)

returns true if the value of the field equals the argument to is(). You don't need to check for a fields existance before using these methods as they will do it for you and return false if they don't.

lessThan($value) and greaterThan($value)

Self explanatory, both take an integer as an argument. Warning: If you use it on a non numeric field it will return false.

Maverick Specific

get_buttons($field_name) and the_buttons($field_name)

Return a formatted button group with a huge range of styles catered for - very Maverick specific. Expects our usual button group format.

Supported fields

Currently Supported fields

Third party fields:

Special Fields


All versions of icenberg with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mvrk/icenberg contains the following files

Loading the files please wait ....