Interface ContentAreaListValue

All Superinterfaces:
EditorValue<SectionList>

@Deprecated public interface ContentAreaListValue extends EditorValue<SectionList>
Deprecated.
Since 5.0.107 - usages of CMS_INPUT_CONTENTAREALIST should be replaced with FS_CATALOG.
Tagging interface for an EditorValue representing the FirstSpirit input component CMS_INPUT_CONTENTAREALIST.
Since:
3.0.78
Example:
How to get and store the list of referenced sections
import de.espirit.firstspirit.access.editor.*;

import de.espirit.firstspirit.access.Language;
import de.espirit.firstspirit.access.editor.value.InvalidValueException;
import de.espirit.firstspirit.access.editor.value.SectionList;
import de.espirit.firstspirit.access.project.Project;
import de.espirit.firstspirit.access.store.pagestore.Section;
import de.espirit.firstspirit.access.store.templatestore.SectionTemplate;

import org.jetbrains.annotations.Nullable;

import java.util.Iterator;


/**
 * Example how to get the list of sections and create new section(s) from a ContentAreaListValue and store a section into a ContentAreaListValue.
 *
 * @since 4.2.34
 */
public class ContentAreaListValueExample {

	/**
	 * Creates a new section in the given ContentAreaListValue editor - using a section template of the given template store.
	 *
	 * @since 4.2.200
	 */
	public Section createSection(final ContentAreaListValue editor, final Project project) throws InvalidValueException {

		// 1. get project masterlanguage
		final Language masterLanguage = project.getMasterLanguage();

		// 2. get the Section List
		// - ContentAreaList is language independent by contract, therefore it doesn't matter which language is used
		final SectionList sectionList = editor.get(masterLanguage);

		// 3. use the first section template of allowed templates
		final Iterator<SectionTemplate> allowedIterator = editor.getAllowedSectionTemplates().iterator();
		if (!allowedIterator.hasNext()) {
			throw new IllegalStateException("no allowed templates defined for this editor");
		}
		final SectionTemplate sectionTemplate = allowedIterator.next();

		// 4. create the new section -> will be added automatically
		final Section section = sectionList.create("NewSection", sectionTemplate);

		// 5. store the modified section list to the editor
		editor.set(masterLanguage, sectionList);

		return section;
	}


	/**
	 * Returns the first section of the given ContentAreaListValue editor.
	 *
	 * @since 4.2.200
	 */
	@Nullable
	public Section getFirstSection(final ContentAreaListValue editor, final Project project) {

		// 1. get project masterlanguage
		final Language masterLanguage = project.getMasterLanguage();

		// 2. get the SectionList
		// - ContentAreaList is language independent by contract, therefore it doesn't matter which language is used
		final SectionList sectionList = editor.get(masterLanguage);

		// 3. get the first Section out of the SectionList
		Section section = null;
		if (!sectionList.isEmpty()) {
			section = sectionList.get(0);
		}

		return section;
	}


	/**
	 * Returns the SectionList (persistence object) of the given ContentAreaListValue editor
	 *
	 * @since 4.2.200
	 */
	@Nullable
	public SectionList getSectionList(final ContentAreaListValue editor, final Project project) {
		// 1. get project masterlanguage
		final Language masterLanguage = project.getMasterLanguage();

		// 2. get the SectionList
		// - ContentAreaList is language independent by contract, therefore it doesn't matter which language is used
		return editor.get(masterLanguage);
	}
}
  • Field Details

  • Method Details

    • getForm

      Deprecated.
      Covariant return of concrete form container.
      Specified by:
      getForm in interface EditorValue<SectionList>
      Returns:
      The form definition.
      Since:
      4.0.17
    • getAllowedTemplates

      @Deprecated SectionTemplate[] getAllowedTemplates()
      Deprecated.
      since 4.2.200 - use getAllowedSectionTemplates() instead
      Forwards to getAllowedSectionTemplates(), providing an array instead of a list.
      Returns:
      Array of section templates.
      Since:
      3.0.78
    • getAllowedSectionTemplates

      @NotNull @NotNull Iterable<SectionTemplate> getAllowedSectionTemplates()
      Deprecated.
      Returns an unmodifiable iterable of allowed section templates which could be used to create new sections.
      Returns:
      an unmodifiable iterable of allowed section templates for this editor
      Since:
      4.2.200
    • getDisplayNames

      String[] getDisplayNames()
      Deprecated.
      Provides the display names as array.
      Returns:
      Thedisplay names.
      Since:
      3.0.78
    • getDisplayValues

      String[] getDisplayValues(Section section)
      Deprecated.
      Provides the display values for the given section as array.
      Parameters:
      section - The section.
      Returns:
      The display values.
      Since:
      3.0.78
    • get

      @NotNull @NotNull SectionList get(Language language)
      Deprecated.
      Get the value object in the specified language. If the editor is not language dependent, the returned object always will be the same for any given language.
      Specified by:
      get in interface EditorValue<SectionList>
      Parameters:
      language - The language to look up.
      Returns:
      The language specific value object.
      Since:
      4.0.17