Giter VIP home page Giter VIP logo

paragraphs's Introduction

Paragraphs

Paragraphs is the new way of content creation!

It allows you — Site Builders — to make things cleaner so that you can give more editing power to your end users.

Instead of putting all their content in one WYSIWYG body field including images and videos, end-users can now choose on-the-fly between pre-defined Paragraph Types independent from one another. Paragraph Types can be anything you want from a simple text block or image to a complex and configurable slideshow.

Paragraphs module comes with a new "paragraphs" field type that works like Entity References. Simply add a new paragraphs field on any Content Type you want and choose which Paragraph Types should be available to end-users. They can then add as many Paragraph items as you allowed them to and reorder them at will.

Paragraphs module does not come with any default Paragraph Types but you have complete control over what fields they should be composed of and what they should look like through the standard Backdrop Manage Fields and Manage Display screens.

You can also add custom option fields and do conditional coding in your CSS, JS and preprocess functions so that end-users can have more control over the look and feel of each item. This is way much cleaner and stable than adding inline CSS or classes inside the body field's source.

So... what's it gonna be? Accordions, Tabs, Slideshows, Masonry galleries, Parallax backgrounds...? Think big!

Some more examples:

  • Add a block of text with an image left to it
  • Add a slideshow between blocks of text
  • Add a youtube embed between your text
  • Add quotes between your content blocks

Installation and Usage

Paragraphs-Related Modules

(Open a PR to request your Paragraphs-related module to be listed here.)

Issues

  • Bugs and Feature requests should be reported in the Issue Queue.

Current Maintainers

Credits

License

This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.

paragraphs's People

Contributors

argiepiano avatar bdalomgir avatar bradbulger avatar derhasi avatar docwilmot avatar herbdool avatar iameap avatar jenlampton avatar laryn avatar robertgarrigos avatar rv0 avatar serundeputy avatar sleepingmonk avatar yorkshire-pudding avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paragraphs's Issues

Error when trying to remove Paragraph

Many thanks for your work on getting Paragraphs into Backdrop.

I've been testing on Backdrop 1.10.1. I get a fatal error when trying to remove a Paragraph from a node using the 'Remove' button.

The Paragraph is removed as expected but when the node is saved I get a ' The website encountered an unexpected error. Please try again later' message.

In the logs I have the following error:

Error: Call to undefined method ParagraphsItemEntity::isDefaultRevision() in ParagraphsItemEntity->deleteRevision() (line 464 of /home/insite/webapps/backdrop/modules/paragraphs-1.x-1.x/ParagraphsItemEntity.inc).

Cheers

Views support is broken in 1.x-1.x branch

When using the current 1.x-1.x branch, it's not possible anymore to show a Paragraphs field in Views. In the latest release version 1.x-1.0.1 it's working fine.

Following commit seems to break the functionality: 4e6a801

Steps to reproduce:

  • Create a paragraph bundle P with at least one field (e.g. text or image)
  • Create content type X with at least one paragraph field with reference to P
  • Create a view showing nodes of type X (using fields)
  • Add a paragraph field to this view
  • Save the view and look at the results

Expected behaviour (as observed in 1.x-1.0.1):

  • The Paragraphs field is shown in the view.

Actual behaviour (as observed in current 1.x-1.x branch):

  • The rendered Paragraphs content is empty.
  • Every time this view is called, the following error message is logged:

Warning: Theme hook "entity" not found.

PHP notice: Undefined property: ParagraphsItemEntity::$original in file_field_update()

After more testing I got the following PHP notice after reverting a node to any revision - it's not coming from Paragraphs module directly, but it's probably related:

Notice: Undefined property: ParagraphsItemEntity::$original in file_field_update() (line 267 of [...]/core/modules/file/file.field.inc).

Originally posted by @sternhagel in #31 (comment)

After testing I broke this into its own issue since it happens upon any save or update, whether revisions are involved or not.

[2.0] Rename `bundle` to `type` and deprecate functions/permissions that use `bundle`.

EDIT/CLEAN UP:

The term "bundle" has been changed in front-facing places but it remains to clean up the code (function names, permission names, etc.) and deprecate the old "bundle" versions in the same way Backdrop core:

  • provide a wrapper where paragraphs_bundle_load calls call paragraphs_type_load and mark paragraphs_bundle_load as deprecated

Fatal error after updating to 1.13.0 ("Cannot make static method EntityInterface::entityType() non static")

Hey there.
I just updated from 1.12.6 to 1.13.0. Everything seemed to go right. Site looks good, nothing seems broke. So I cleared caches and then ran cron only to receive this:

Fatal error: Cannot make static method EntityInterface::entityType() non static in class ParagraphsItemEntity in /home/sssssss/public_html/modules/paragraphs/ParagraphsItemEntity.inc on line 612

So cron didn't run.

Any ideas...?
Should I revert to 1.12.6...?

Warm regards from sunny México.

José

Error when adding field to bundle

I added a paragraph bundle and added a file field. I got this error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'paragraphs_bundle_title_callback' not found or invalid function name in _menu_item_localize() (line 754 of /app/core/includes/menu.inc).

Content translation doesn't pre-populate paragraphs

With Backdrop's content translation turned on, attempting to create a translation of a content item does not pre-populate Paragraphs with the appropriate fields. It does seem to allow content to be created but you have to recreate each paragraph manually in the new language content page.

Needs further testing, including of the Paragraphs - Internationalization submodule (which can't currently be enabled).

Focus jumps to node title

When adding a new paragraph, focus keeps jumping back to the node title which is a usability problem.

`entity_save` issue

Reported on the Forum by @Fjeder:

To be able to create paragraphs programatically i had to change line 418 of ParagraphsItemEntity.inc:

return entity_save($this->hostEntityType, $host_entity);

Changed to:

return entity_plus_save($this->hostEntityType, $host_entity);

Add dependency on Entity Plus

Removing the EMW dependency ended up causing a bunch of loose ends that nobody seems to have time to comb through. I'm planning to add a dependency on Entity Plus at this point which seems to solve a handful of issues in the queue and will make things simpler for me.

The biggest issue will be figuring out how to introduce a dependency when many people already have the module installed. How can we make sure they install the latest version of Entity Plus before upgrading Paragraphs?

Revisions don't seem to work with paragraphs

Haven't done any further testing yet but I see this when trying to save a revision on a node that has paragraphs field:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY': INSERT INTO {paragraphs_item_revision} (revision_id, item_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 1 ) in backdrop_write_record() (line 8086 of /path/core/includes/common.inc).

EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' in ParagraphsItemController->save() (line 55 of /path/modules/paragraphs/ParagraphsItemController.inc).

EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' in NodeStorageController->save() (line 320 of /path/core/modules/node/node.entity.inc).

Issue with tokens?

I'm not sure about this, but it shows up in my status report with a warning that says "Problems detected".

The following token types are not defined but have tokens:

$info['types']['paragraphs_item']

Field group on paragraph display doesn't show up

I've added a Field group to the Default display of a Paragraph bundle but the Field group doesn't show up on the content item with the corresponding Paragraph field.

So far, I've tried to display a Div and a Fieldset group, and both don't show up, irrespective of the group's setting "collapsed" vs. "collapsible".

I'm new to Paragraphs with Backdrop, so I might have missed something. I'd appreciate if someone could try to reproduce the issue.

Field data and paragraph items are not removed from database when deleted

I have been doing some testing with Paragraphs and have identified a few issues with orphan data being left in the database:

- Field data: When I create new paragraphs on a content type and fill in the info, I can see them populate into the respective field_data_field_fieldname tables. However, if I delete that paragraph item, the content in that table is not removed.
- Paragraph item data: When I create a paragraph bundle and use it, then later remove it, the paragraphs_item table continues to hold information referring to bundles that no longer exist in paragraphs_bundle.

cannot install this module with drush

I couldn't install this module with lando and drush. Got this error message:

Error: There is no release located at https://github.com/backdrop-contrib/paragraphs/releases/download//paragraphs.zip.
	Try visiting the paragraphs page directly: https://github.com/backdrop-contrib/paragraphs

I could install other modules using this method, but not this module. Bakcdrop 1.11.2. Lando v3.0.0-beta.47

Allow separate modal edit/delete/sort of Paragraph items

I have been meaning to see if I could figure out how to allow editing of individual Paragraph items via contextual link rather than requiring the entire node to be loaded. (For example, if one item way down the page needs a minor tweak, it would be way simpler to be able to edit that one item rather than load the entire page, scroll down to find that paragraph with everything else around it, potentially have to expand that Paragraph item before being able to edit it...)

My idea included opening the edit window in a modal and refreshing the page when it was submitted, but that may not be necessary. It turns out there's an issue (and a patch) in the Drupal queue that aims for very similar functionality (minus the modal). And follow up issues could be the ability to delete/insert Paragraphs in this way, and maybe even reorder (e.g. Move up, Move down).

I've tried to implement that first patch in the issue-60 branch.

The main issue I'm finding seems to be that host entity details aren't being tracked. This causes the access check to fail and the save to fail (Unable to save a paragraph without a valid reference to a host entity.).

I've temporarily adjusted the access check to include a new permission rather than checking whether the user has access to update the host entity, and could override the save not to check the host entity as well (but then we'd lose Paragraph revisions on nodes when edited in this way).

"You are not allowed to add any of the bundles."

I'm having trouble giving access to an editor to be able to add/edit bundles. I've tried with and without the permissions sub-module (and the related permissions that it creates), and have also tried granting "Administer paragraphs bundles" as a test (although I'd prefer not to do this on the live site), but this is the persistent message:

You are not allowed to add any of the bundles.

Paragraphs and Views

I was having trouble trying to get Views working with Paragraphs and I think I figured it out but can't figure out how to upload an image to the wiki... so I'm adding it here.

paragraphs-views-backdropcms

views_handler_relationship issue

Reported on the Forum by @Fjeder:

Warning: Declaration of paragraphs_handler_relationship::options_form(array &$form, array &$form_state) should be compatible with views_handler_relationship::options_form(&$form, &$form_state) in require_once() (line 6 of /<site>/modules/paragraphs/views/paragraphs_handler_relationship.inc).

Remove dependency on EMW

This uses a few calls to entity_metadata_wrapper() which needs removing and needs to update the controller to save revisions. Once this is done can remove dependency on EMW.

Maintainer transfer

Per Gitter:

@docwilmot: @laryn you seem to be the main man on the Paragraphs queue. Like I mentioned I dont need or use it. You want to take over maintainership please?

@laryn: Okay, but can I ask questions if I need? 😄

Scheduling a node for publication in the future fails if it has a paragraph field on it.

When scheduling a node w/ a paragraphs field to be published in the future it fails:

gff ~/code/aturnintime/htb (master) 
└─ $ ∴ lando.dev drush cron
Error: Call to undefined function entity_revision_load() in paragraphs_item_revision_load() (line 60 of /app/web/modules/contrib/paragraphs/paragraphs.module).
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                                                   [error]

The function entity_revision_load was provided by the entity module in D7. In Backdrop the function is in entity_plus and therefore is namespaced as entity_plus_revision_load.

Separate editing follow up improvements: modal?

Follow up to #60 - is it feasible to have the contextual paragraph links open in a modal (like the "Configure block" modal)? Having the page beneath refresh after a save in one way or another would be important.

Scheduled publication doesn't work with paragraphs

Cron gave this error when trying to publish a node that has paragraphs:

Error: Call to undefined function entity_revision_load() in paragraphs_item_revision_load() (line 60 of /path/modules/paragraphs/paragraphs.module).

Hiding and rendering content in .tpl

From the Backdrop Forum:

I'm trying to render fields in paragraphs-item--bundlename.tpl.php like it's shown in the description:

<?php print render($content['field_example']); ?>

When I go and check it in the frontend, then I see the "site under maintenance" message. Only for the link I was trying if it is working.

Is it a bug or am I doing something wrong?

Schema version is incorrect

The Drupal 7 update hooks were left in for the initial release, causing a problem with the schema version. This results in the Backdrop update hooks not firing.

Paragraphs don't display on taxonomy terms

I added Paragraphs to a taxonomy vocabulary, but they don't seem to be displaying on the term's page. I've double checked the display settings and the paragraph is set to show:

screenshot_2018-08-23

Non-existent function: `entity_load_single()`

There is a single call to entity_load_single(). That function only existed in Drupal's 'Entity' module: https://git.drupalcode.org/project/entity/blob/7.x-1.x/entity.module#L216. The entity functions that got merged into Backdrop core don't include an entity_load_single(), however entity_load() was re-factored to load a single entity: https://api.backdropcms.org/api/backdrop/core%21modules%21entity%21entity.module/function/entity_load/1

Therefore this single function call needs to be changed. PR attached.

Preprocessing difficulty

An issue I raised on Gitter and haven't been able to crack yet:

I'm trying to preprocess a Paragraph bundle and following someone's post related to D7, I'm trying to use hook_preprocess_entity but am not able to get anything to even show up in the logs using debug – does that hook still exist in Backdrop?

https://drupal.stackexchange.com/a/185513/33636

@alexfinnarn 10:55

seems to be https://api.backdropcms.org/api/backdrop/core%21modules%21entity%21entity.api.php/function/hook_entity_view_alter/1 "Alternatively, it could also implement hook_preprocess_ENTITY()"

that is all I can tell. Isn’t there some function that gathers all the possible hooks available?

maybe https://api.backdropcms.org/api/backdrop/core%21modules%21system%21system.api.php/function/hook_module_implements_alter/1 and search for it there?

Improve collapsible paragraphs

This is an issue from the Drupal 7 queue that is marked "Needs Review" and could improve the UI.

Problem/Motivation

Basic support for collapsible paragraph items was added in #2273555: Collapsible paragraphs in node edit form, but a number of UX enhancements requested in that issue failed to make it into the committed patches and the UI could still use some refinement. To avoid confusion, I'm copying those outstanding issues here for continued development.

Proposed resolution

  1. Move all the actions available on a paragraph item (edit/collapse/remove) into a single drop button, instead of displaying them as separate buttons. This drop button can be floated right at the top of the paragraph item, saving significant space.
  2. Add links at the top of the paragraphs field to expand all/collapse all.
  3. Add an option to the drop button for each paragraph item to reset any unsaved changes.
  4. Add an option to completely disable collapsing items in the configuration form for paragraphs fields.

https://www.drupal.org/project/paragraphs/issues/2476253

Change help text when there's only one paragraph bundle

When I create content with a Paragraphs field, there is a help text like the following at top of the field:

No Paragraphs added yet. Select a Paragraph type and press the button below to add one.

The "Select a Paragraph type" part appears even when there's only one Paragraph bundle (i.e. type) available, so that there is no option to choose a type. In this case a help text without the "type" part would be better, for example:

No Paragraphs added yet. Press the button below to add one.

Error when translating nodes with nested paragraphs

I am getting the following error when trying to translate a node which includes paragraphs:
EntityMetadataWrapperException: Unknown data property [field_name]. in EntityStructureWrapper->getPropertyInfo() (line 335 of /modules/entity_plus/includes/entity_plus.wrapper.inc).

I have installed the following modules:

  • Entity Plus 1.x-1.0.3
  • Paragraphs 1.x-1.0.1
  • Replicate 1.x-1.2
  • Replicate Paragraphs 1.x-1.3

Backdrop version: 1.14.1

Hope someone out there might have a solution to this problem, since I really don't want to manually create all paragraphs on each node for each language.

Match submenus

The "Paragraph type" submenu should more closely match the "Content type" submenu (e.g. add Paragraph types with child menus for Display, etc.)

Screen Shot 2020-01-16 at 11 05 48 AM

Screen Shot 2020-01-16 at 11 05 56 AM

Node clone doesn't work with paragraphs

It would be nice if Node Clone could work with Paragraphs (and it looks like the functionality should be there, just needs some tweaks apparently).

Error: Call to a member function value() on null in paragraphs_clone_items() (line 59 of /path/modules/paragraphs/paragraphs.node_clone.inc).

paragraph bundle not exported/imported

I created a new paragraph bundle in a dev site, added a new field to it, checked that it was working and then exported the new configurations with drush bcex. Commited and pushed changes to my git repository and pulled from my staging site. Then imported the new configurations with drush bcim to the staging site and pargraph bundle was missing. Checked back again that config files were present, cleared cache a few times, but paragraph bundle was sill missing.

Finally, I just created manually the paragraph bundle with the same machine name and voilà! it appeared again with its field. Wondering why...

Undefined index error for #type on remove_button markup item

I have a Paragraphs field set to use buttons, with no default values so it starts out with no paragraphs. When I am looking at the node creation form, if I click on the Add Paragraph button, and then the Remove button, I get an error:

Notice: Undefined index: #type in form_process_actions() (line 3369 of /mypath/www/core/includes/form.inc).

It's complaining about the 'remove_button' item that's just #markup value. If you add '#type' as "markup", the error goes away.

Review `entity_revision_` functions

In #33 I (maybe temporarily) duplicated the entity_revision_load() function but am now seeing that we have other entity_revision_ function calls, and there was already some other duplication of entity_revision_ functions during the port.

It would be good to review and determine if there are any loose ends here, and whether we can move forward for now with the duplicated functions or whether we should consider a dependency on Entity Plus to provide these functions, or wait to see if they get in core.

See also (a more thorough code review is likely necessary):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.