texts:
How do i set the starting position of the pager using EntityFieldQuery pager. Here is my current code.

$query = new EntityFieldQuery();
$query
    ->entityCondition('entity_type', 'node', '=')
    ->propertyCondition('status', 1, '=')
    ->propertyCondition('type', 'event')
    ->pager(1);

return  $query->execute();

Reading the docs. enter link description here    I can't see how to set the starting point of the pager.

Further info. I'm using this query to create a custom cvs dump. So it won't appear as normal html grid.

Also. I have a lot of nodes. So i need to ensure the start and limit are in the sql query and not filtered using php

edit

It turns out i was using the wrong property. Instead of pager use range.

http://treehouseagency.com/blog/tim-cosgrove/2012/02/16/entityfieldquery-let-drupal-do-heavy-lifting-pt-1


texts:
I'm using the LDAP feeds module to import my users from LDAP to Drupal. However, it doesn't work... I'm only getting a lot of array merge errors (trying to merge a non-array object with an array in user_save), most likely because the picture is not imported properly and then attempted to merge with the current user.

The picture is in base64 in LDAP, attribute name 'jpegphoto'. In the LDAP feed, i have jpegphoto.picture as source, and User Photo as a target. Assuming that the base64 is the standard for pictures in LDAP and that pictures are supported - though not documented - i think there must be someone who knows how to import these pictures.


texts: How can I print the node title in Time Spent view?

texts:
I'm trying to create a (page)view with time spent on different nodes filtered by logged in user. To do this I use the Time Spent module. When trying to create a Time Spent view, the only thing I can output is the time spent id and the time spent length. I am also able to get the user as a relationship. With this I can create the contextual filter to filter on user.
But now I still have a list of random ID's with a time next to it. Without knowing on what node the time is spent.
So my solution was to add a new relationship to this view type to fetch the connected nodes field values. But I don't really understand what I'm doing. By copy and pasting in time_spent_views.inc I created the following relationship:
  $data['time_spent_page']['nid'] = array(
    'title' => t('Node'),
    'help' => t('Node time spent.'),
    'relationship' => array(
      'base' => 'node',
      'base field' => 'nid',
      'id' => 'standard',
      'label' => t('Node time spent'),
    ),
  );

This does give me more fields to display, but not the fields I want. I get fields like Link to content, Link to edit content. But no ID or Title field. How to expand this to also see the field of a node like, title and other fields?


texts: I'm using ne-impot and ne-export with drush for importing and exporting nodes. When exporting, as part of the uuid module, the URL alias is included with the export. However, when importing a node, the alias is not kept. I have tried using another custom module (https://github.com/kapasoft-config-scripts/designssquare_alias_path) that I found from this site: http://margotskapacs.com/2014/04/solving-menu-import-issue-when-featuring-sample-data-in-drupal, but that doesn't seem to be working either. Does anyone know of a way to import and export a URL alias along with the node from the command line? Thanks!


texts: How can I redirect node page for a content type to custom URL?

texts:
I need to redirect all the pages for a content type to a custom URL in Drupal 8.

I used to do this in Drupal 7 by implementing hook_init() with the function drupal_goto() or by using the Rules module. Unfortunately both hook_init() and drupal_goto() are removed in Drupal 8, and the Rules module is not stable yet, and I can't figure out how to do it in Drupal 8.

How can I achieve what I am trying to do?


texts:
I installed the latest recommanded release of CKEditor, but when I tried to change content authoring I got an error saying it wasn't installed properly.

So I tried uninstalling it by doing:

disable module ckeditor
uninstall
tried to look for the    module in my project and    delete there
also (site/all/modules) but it isn't present

When I trie to reinstall (dev version) I get:

Archivers can only operate on local files:
temporary://update-cache-235f2e3c/ckeditor-7.x-1.x-dev.tar.gz not
supported
and then when I trie the same link a second time:
CKEditor is already installed.

Also clearing the cache in development doesn't work.
How can I properly delete and reinstall ckeditor?


texts: Unable to access page when using RouteSubscriber::alterRoutes() to override display for path

texts:
Because of a need to be able to combine elements from two different entities - a node and a Commerce product - in one page, I am attempting to implement my own custom controller and override the built in route for the node display. From what I've found, the correct way to do this is with a RouteSubscriber (see here and here for examples I'm following). Based on that, here's what I have:
my_module.routing.yml
my-module.product_group:
  path: '/products/{group_title}/{product_title}'
  defaults:
    _controller: '\Drupal\my_module\Controller\ProductGroupDisplay::build'
    product_title: ''
  requirements:
    _permission: 'access content'
  options:
    parameters:

The idea is that whether the URL is at products/my-node-title or products/my-node-title/1234, my custom ProductGroupDisplay controller is used. This works great for the products/my-node-title/1234 path, but not for the base products/my-node-title URL.
And here's what I have to take over that base URL to use my controller:
my_module.services.yml
  my_module.route_subscriber:
    class: Drupal\my_module\Routing\MyModuleRouteSubscriber
    tags:
      - {name: event_subscriber}

my_module/src/Routing/MyModuleRouteSubscriber.php
<?php

namespace Drupal\my_module\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class MyModuleRouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    // Replace "some.route.name" below with the actual route you
    // want to override.
    if ($route = $collection->get('entity.node.canonical')) {
      $route->setDefaults([
        '_controller' => '\Drupal\my_module\Controller\ProductGroupDisplay::build',
      ]);
    }
  }

}

Unfortunately, what happens is that when I go to /products/my-node-title (this is a URL alias for a product_group node where the alias pattern is products/[node-title]), I get a You are not authorized to access this page. error message, even when logged in as the default admin user. In addition, my alterRoutes() method is not accessed (i.e. it doesn't hit my debugging breakpoint in the method). If I remove the service from my_module.services.yml, I can access the page fine. What am I doing wrong?


texts: How can I check the fields I've created?

texts:
I've got a basic question - in Drupal 7 is there a way to simply manage the fields you've created through some sort of UI that is not admin/structure/types/manage/NODE_TYPE/fields?

I'm getting an error:

FieldException: Cannot change an existing field's type. in field_update_field() (line 234 of /var/www/vhosts/server_path/modules/field/field.crud.inc).

I'm trying to track down why this error is occurring and so far I've had no luck. I've checked some stuff on drupal.org, but I've not been able to find anything definitive to clear this up.

And help would be greatly appreciated.


texts: Why do I have error related to unknown themes during synchronization?

texts:
When I try do synchronize from my local site to the remote one, I get this bunch of errors which prevent configuration to be imported.

It seems to be related to some themes (alpha_responsive_theme, elegant_theme, mm, nucleus, tb_sirate, zeropoint) but why?
I'm pretty sure I don't have these theme in my configuration: I have these folders in core/themes bartik, classy, engines, seven, stable, stark and onepage_zymphonies_theme which is set to be the default one (seven being the Administration theme).

Any idea why it happens?
And how to get rid of it?
Thanks in advance.


texts: How do I get the $language object inside a form builder?

texts:
I have this necesity to use $language inside MY_MODULE_form($form, &$form_state) function and it seems is not available. I tried to define it as global, but it displays blank.

global $language_content;
dpm($language_content->language);

My simplified structure of MY_MODULE_form() looks like this:

function MYMODULE_form($form, &$form_state) {
global $language_content;
$form['name'] = array(
      '#type' => 'fieldset',
      '#title' => t('Name'),
  );
  $form['back'] = array(
      '#markup' => '
'.t('Back').'
',
  );
  return $form;
}

I found a hardcoded PHP solution:

if(strpos($haystack, 'en')) {
    $back_path = "/project/en/my/home";
    }
  if(strpos($haystack, 'fi')) {
    $back_path = "/project/fi/my/home";
  }
  $form['continue-shopping'] = array(
      '#markup' => '
'.t('Back').'
',
  );

I am looking however to something more elegant.


texts: Drupal #attached doesn't work with some themes

texts:
I've written a module which loads CSS and JS files using the #attached property.  This works fine across most themes, but for some themes the files are not loading.

e.g.:

$page['header']['#attached']['css'][] = array(
  'data' => drupal_get_path('module', 'mymodule') . '/css/mymodule_default.css',
  'type' => 'file',
  'options' => array(
    'group' => CSS_THEME,
    'preprocess' => TRUE,
    'every_page' => TRUE,
  ),
);

As there is very little by way of explanation on #attached (most articles repeat the same stuff) I can't figure out where the problem may lie.  Using drupal_add_css() and drupal_add_js() works, but is not recommended for caching reasons, and I prefer to pass settings using attached for this reason.

The #attached properties are showing in the $page array but are not being rendered.

In summary, are there situations when certain themes block the correct rendering of #attached elements that would normally be applied to a render structure by drupal_process_attached()

Any help is appreciated.


texts:
I'm using the modules Migrate and Drupal to Drupal Migration. And I'm just using the UI of the migrate_d2d-module to migrate some content of a D7 site to another D7 site.

It works very well for users and there pictures, and the nodes are migrated too with the fields: title, author, date, body etc. BUT not with the image field! That means the images of the nodes are missing. :-/

How can I solve this? I'm sure I have to do some kind of mapping?

What data I have to use for this:

[field_product_image:destination_dir]
[field_product_image:destination_file]
[field_product_image:source_dir]

The image field is field_product_image and I have exported/imported the content type of the nodes to my new D7 installation.
the Images are stored in default/files/image/galerien.

Thanks for helping me!


texts: How to show each type of content-types just one time?

texts:
I have news content type and it has title, body, image and type. The type is a list(text) and have these values:

sport
Economy
Health
...

And now I need to have these types in a view (block). in view module the field is type (means the news type) I just want each of them shows one time not showing by each published news content.

For example: in that block that I made I have 3 sport news and 2 health news and one Economy!


texts: Is there a standard environmental indicator for Drupal 8 projects?

texts:
I am developing a Drupal 8 site, and I ran into the need to display all errors.
I added this line to my settings file, according to this answer:

$config['system.logging']['error_level'] = 'verbose';

But, when I'm ready to make my site live on production, I don't want error details being shown to end-users.

I want to conditionally display errors based on which environment the codebase is sitting on-- local, dev, staging, and production. In Drupal 8, is there a way to indicate which environment the site is running on? A variable or something? Or is this something that I manage myself?


texts:
I'm using entity_print for PDF generation on two node types. I'd like each to have its own orientation configuration (or just have one override the default). There is an event in entity_print where configuration can be set at run-time, so I have a simple event subscriber, with a method to override the orientation, but I can't seem to get the last piece, which is the entity (bundle label) to switch on.

How can an event subscriber have access to the entity type?


texts:
I had this issue before which I solved:
Add field date to node tpl

Now I need to add the date field in the views.tpl.php

Here's the code:

I want to replace "$date->node_created" with the field_date.

Here's what I know: I can't use $content['field_date'] because the $content array doesn't exist in this template file.

Thank you


texts: Allow all users with a certain role to set Groups Audience to any Organic Group

texts:
I am using Drupal 7.
What I am trying to achieve is the following:
I have several users with a particular role say "A". And I have several content types set as "Group content"
When a user with role "A" creates content I would like the user to be able to set the Groups Audience field to any of the existing Organic Groups.

Is it possible to achieve without adding those users as Administrators to all existing Organic Groups?


texts: How can I extend drush aliases with specific variables?

texts:
I like to know if it is possible to extend drush aliases with more specific path variables. Is there anybody who can tell me how to extend the drush example code, that follows below with array for the file system paths for

temporary files directory
files directory
private files directory

So that I don't have to change them manually after every db sync when the dev server has other path settings then the productive server

This may be a silly question but I just looked at the documentation on github and haven't found any details.


texts: Is there a module for site explanation messages?

texts:
Many sites have text areas which appear to explain things to new users. With an option to hide the message in future.

I haven't seen such a module for Drupal, does one exist?

I have tried googling but to be honest I have no idea what terminology to use when searching for one.


texts:
I have to handle tickets request. Let me explain (sorry for my english):

On the site, each authenticated user create a club (Master Club) and members (Master Members). Master Club and Master Members are two content types.

Each club administrator (authenticated user) must be able to send a request for tickets event and indicate the tickets number by listing the name, address and other data of the shareholders chooses from its list.

The structure is similar TICKET module: Site administrator create a content type EVENT. For each EVENT specify the sector( SECTOR_A, SECTOR_B,.....) and for each SECTOR how many tickets want.

scenario: Let's say you require 3 tickets for SECTOR_A and 2 tickets for SECTOR_B:

This request must be sent to the site administrator which can confirm this request or notify club administrator that instead of 5 tickets they can take only 2 tickets for SECTOR_A and 1 tickets for SECTOR_B..

The club administrator receives this notification and can accept the site administrator's request indicating the members(from its membership list) who want to assign these 3 tickets or refuse.

How set it ?


texts:
I am selling some monthly basis services like website hosting. And I like to get prepaid payment for every month. So, how do I send email to my clients for notification by email to give payment for coming recurring date?

For example - A client purchase a digital service from our website in 5th of Jan. Next recurring payment date should be 5th Feb. So, I like to send recurring payment reminder before 15 days, then before 10 days (if not paid), then before 5 days (if not paid), then in the recurring date i.e. in 5th Feb.

I have install drupal 7, commerce recurring framework module, rules, rules scheduler. Currently I am stuck with how to send periodic email to my client for recurring date, after they have initially pay for the services?

Is this module is perfect for this - https://www.drupal.org/project/datereminder. I think this module - https://www.drupal.org/project/uc_recurring is not sending email reminders. Specially I am looking for email reminders which will work with commerce recurring framework.

So, how can I do this?


texts:
I'm building a block view that shows content related to whatever node is being viewed.  It uses a contextual filter to pull the node author, and then displays content I've tagged as related.  I also have a page view that has an exposed filter so the user can select an author and see all their work.  I want to use the "more" link in views to take the user from the block to the filtered page of that author's work.

Since exposed filters doesn't change the URL, how can I link directly to a view with the correct filter already applied?


texts:
I'm using Drupal 8, and I'm trying to block a user after submitting a certain webform. I have the below scenario:

Only authenticated user can submit and use the webform
Webform submission is limited to once per user
Users can save drafts of the webform and continue filling it later on
Rules action or otherwise should take place when the user has logged in

I tried to use Rules with rules_webform module but to no avail. The actions in rules are all there, but I need a condition to detect if the user has submitted the webform completely, not saved it as a draft only.

Appreciate any help given

Thanks


texts: Content Types in Select list using views

texts: How do I put all my content types into a select list so when users select a content type, they are taking to a page which makes them add new node to the content type?


texts: using a custom module, how to add a  tag after the theme's css files

texts:
I use Drupal 6.

Everytime I use drupal_set_html_head, my <style> code is being added before my theme's <link> entries.

Basically, I want to override the theme's css files with internal css, so I need my <style> to appear at the very end of <head>

I hope it is clear. Thanks!


texts: How to send an eMail notification when a specific field of a node or user has been changed?

texts:
When a node (or user profile) is modified, is it possible to send an email notification only when a specified field is modified?

With the node I have no problem, but I cannot get it to work for a specific field.


texts: How to add javascript after form was validated with ajax callback?

texts:
I created a simple form.
How could I add JavaScript commands after form was validated? Why is it so hard do this?

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => 'submit',
  '#validate' => 'my_validate_callback',
  '#ajax' => array(
    'callback' => 'my_form_callback',
    'method' => 'replace',
    'wrapper' => 'form-wrap',
    'effect' => 'fade'
  )
);


texts:
I have a new drupal install.  The only modules installed so far are devel and ckeditor.

I've added the 'styles' dropdown button and successfully directed it to the ckeditor.styles.js in my theme directory.  At the moment, I'm using a path without tokens.

Initially, I had it at the root of the theme:
/sites/mysite.org/themes/mytheme/ckeditor.styles.js

but, when I updated the file in that location, the styles dropdown did not change.  I tried resaving the ckeditor and I tried clearing all caches (from the performance section), I tried re-editing and saving the .js file (and I tried several permutations of the order); but, the dropdown would not update.  I have browsed directly to the .js file after changing to confirm that it has updated

Eventually, I discovered that the only way to get the styles dropdown to update was to place the ckeditor.styles.js file in a brand new location (each time I want it to update).

So, if I change it I need to move it to:
/sites/mysite.org/themes/mytheme/includes/ckeditor.styles.js

and if I change it again, I need to move it to:
/sites/mysite.org/themes/mytheme/includes/ck/ckeditor.styles.js
etcetera

This seems inefficient and I'm sure there must be another way.  Please let me know if you have insight into this issue.  Thanks

EDIT

I was originally experiencing this issue while using the 'ckeditor' module.  I've switched to the 'wysiwyg' module and I am not experiencing the problem any more.


texts: Can I have more than one child content type for a book content type?

texts:
I have two content type I selected as book content type: Text_book_type and audio_book_type.

Now, I need that these content have different child content type:

chapter_type for text_book_type and audio_chapter_type for audio_book_type.

Is there a way in Drupal 8 to achieve this?


texts: Add a class to the first teaser on /blog page

texts:
On a site I'm developing the first blog teaser on the blog index page /blog is displayed bigger than the other teasers. I do this with a class 'featured', can I add a function in template.php to add this class to the first blog teaser on the /blog page?

Thanks for your time


texts: Best practice: Twig logic versus Preprocess functions

texts:
I use Twig and Twig Tweak to do most of the processing. However, from time to time I need to rely on Preprocess functions to get the desired result.
This led me to a situation where now most of my variables are created in a Preprocess function before handing them over to Twig (this keeps my templates clean, simple and most of all easy to read). I also don't like my code being scattered between Templates and Theme functions.
But regarding Drupal Documentation, this method seems discouraged.

function mytheme_preprocess_node(&$variable) {
 if ($variable['node']->getType() === 'my_content_type_machine_name') {
 $variable['my_title'] = $variable['node']->field_my_title->value;
 }
}

You may now use the more concise {{ my_title }} in your twig file to
refer to {{ node->field_my_title->value }}.
However, while this might be possible, it is discouraged to create
new variables in this manner. Using {{ node.field_my_title.value }}
is fairly reasonable to type and avoids any potential issues and
should be preferred.

So basically my question is: Are there any simple rules to follow regarding Twig versus Preprocess functions for additional logic?


texts: Are field collections suitable to model single instances of hosted entities?

texts:
I know that field collection is suitable for dynamic content, in which I can put many instances of the same hosted entity embedded in a host entity.
But, if I have a host entity composed by a single instance of different embedded entities, each one with almost the same fields (like in my example underneath) but semantically different, from a architectural and performance point of view, is a good choice to model each hosted entity as a different field collection for reusing the same fields, or is more convenient to create as much similar fields as required to model all the embedded entities?
My example:
I've an entity that models a registration, each instance has three profiles, one for the customer, one for the bill and one for other contacts. The three profiles can be all different or all the same, but they must be semantically separated.
Each profile has almost the same fields (addressfield, email, phone, mobile phone and so on).
In this case is better to create three different versions of each field, or to create three field collections type, each one with the same fields?


texts: Filtering out duplicate dates from different nodes in views

texts:
I have a "This day in history" page on my website, which when viewed in a monthly view shows of list of everything that has happened on each day in the month (so, for example January might say January 1: Monkeys learn to motorbike, January 2: Otters invade, etc.)

My issue is we have some new historical dates we want to add, so in this view I'm starting to see duplicate dates that have different content. (i.e, January 10: Yeti discovered, January 10: Moose have picnic with Bears).

The problem is I don't want to have duplicate dates on this view, rather I only want the most recently published/updated node to show up. Is there a way I can order a unique based off of a date field in views?

I'm sure I could probably do this through a views template and just manually remove the duplicate dates, but I would rather just limit the amount of data I'm receiving in the first place.

I'm wondering if this could be done through aggregation? Group my responses together based on their date, and only allow one item per group?


texts: How to alter output of markup on a specific views field

texts:
Is there a way to change the output programatically on a specific field in d8 views?
I have a field called 'IMCID' which I want to output as a link, but the link is going to change based on the value of another field for that row.
For example, if IMCID of row #1 is 15, and Format of row #1 is 'Copy', then I want the output URL to be something like example.com/copy/15, however if IMCID of row #1 is 15, and Format is 'Hard Copy', then the output URL would be example.com/hardcopy/15
If possible, I would like to avoid making multiple template files for individual fields, as this functionality will be carried over onto other fields later on, and would rather not have to manage a ton of template files.
I have tried using hook_pre_render() and hook_post_render(), but the markup doesn't appear to be in this hook so I am not sure how to update the link URL.


texts: How do I get total webform submission count of multiple webforms?

texts: I am able to get the webform submission count total for single webforms, but when I filter for multiple webforms (using the OR operator) it only shows the total count for 1 of the webforms. How can I have Views add the counts for all of the webforms I filter?


texts: Count only published nodes with taxonomy term

texts:
I have implemented a view according to this question: Views and node count for taxonomy terms

But the view also counts the unpublished content.

How can I modify the view to count only published content?


texts: Manage Display Format options not saving

texts: I'm trying to edit a field label under Product Type > Manage Display. I expand the settings and type in "Product Name" and his "Update" and then scroll to the bottom and his "Save". When I expand the settings again, the Label field is blank again. Any thoughts on why this might not be saving this? Note, it doesn't seem to be working on other node content types either.


texts:
I'm having a very strange problem:
Most user roles can login without a problem (administrators, clients, etc...).

But users with the 'registered user' role can not login through the form. The login form does not respond. In the log messages the failed login attempts are not logged.

The only way the users (with role 'registered user') can login is through the request new password link.
So the user clicks on the link, receives an email with a login link, and when they click on the link in the email they are logged in. So than they can edit their account and even change the password.

However, when they log out again and try to login with the new password it does not work anymore, the form does not respond again.

The only way that user can get logged in again is through the request new password procedure.

Anyone have any idea what could be causing this?

I suspect it has something to do with some kind of permissions.
Some of the modules i installed who could maybe give a conflict:
Logintoboggan, Registration role

Any help would be greatly appreciated.

Greetings


texts: Drupal API to check a particular user is logged-in, or not

texts: Is there an Drupal API to check whether a user is currently logged in or not, based on the user ID, such as is_user_login($uid)?


texts: Comparing node creation and modification dates in twig

texts:
I want to compare a node's creation date and modified date in Twig, and it drives me bonkers. I've looked at various examples and snippets as part of this, this, this or this external source.

Using Drupal 8, Bootstrap 3, Bootstrap Layouts, Display Suite, and a custom  sub-theme, I have a twig template customising what is going to be displayed and how. This custom template is a copy of the default bootstrap layouts 1 column template.

Within the template, I can access and print the dates using this:

{{ main.content.node_changed_date }}
{{ main.content.node_post_date }}

and all is well.

However, I want to compare the dates in my template like so:

{% if main.content.node_post_date|date('Y-m-d') > main.content.node_changed_date|date('Y-m-d') %}
    {{ main.content.node_post_date }}
{% endif %}

But this barks at me with the following error:

The website encountered an unexpected error. Please try again later.
TypeError: DateTime::__construct() expects parameter 1 to be string, array given in DateTime->__construct() (line 455 of /home/michel/devel/vendor/twig/twig/lib/Twig/Extension/Core.php).

DateTime->__construct(Array, Object) (Line: 455)
twig_date_converter(Object, Array, Object) (Line: 380)
twig_date_format_filter(Object, Array, 'Y-m-d') (Line: 77)

Yes, I use Composer to manage my installation.

What am I doing wrong?

Pulling my hairs

Michel


texts: Change text format used for text field when displayed in a view?

texts:
I have a content type with a text field that may contain a token from the Media module (that WYSYWIG inserts). This token is typically transformed into HTML by enabling a specific filter for the text format used.

However, I want to create a view for nodes of this type that just strips out the media token entirely. This allows me to show the content w/o any images or captions.

Initially, I thought I could add my own field formatter using hook_field_formatter_info and hook_field_formatter_view, strip out the token right in the formatter, and then use that formatter when rendering the field in the view (views lets you select a formatter, like Default, Trimmed, etc).

The problem there is that by the time hook_field_formatter_view is called, the safe_value for the field is already computed and text has already been run through the input filter (so the token has been transformed).

I wonder if there's a way I can create a new text format that doesn't include the Media token filter and somehow tell views to render the field using that, but it doesn't appear like I can.


texts: How to display number of flagged comments for each author

texts:
I am trying to copy the "thanked"-function seen in vBulletin forums. Here the author of a topic can thank the author of a comment and the number of comments a person have been thanked for is shown in the author pane.

I have used the Flag module to allow a comment-specific flag but I can't figure out how to display the count number of thanks for each user. I have tried to create a view and display it with views_embed_view but i don't know how to choose count for the specific author? I have also thought of using entityfieldquery but I don't think it can see which comments that are flagged?

Is there a solution to my problem?


texts:
I have a custom page template (Drupal 7) created from a basic page and I call it page--node-84.tpl.php. I'd like to manually print/render the 'body' field from this page and so I tried that doing this:

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

But that is not working because I believe I can only print a field when using a node template and not a page. Correct?

Could someone help me with a pre-processing function to be able to print a field in a page template. Or maybe using a custom node template is the way to go?


texts:
I'm re-building a travel website and need the trip search form to have the "Arrivals" select populated using AJAX once the departures has been selected to remove any empty search results.

I have followed all the tutorials I could find online, namely: Views AJAX Dynamic Dependent Exposed Filters & AJAX populated filter breaks when Views Dependant Filter module added, applied patch #106 from https://www.drupal.org/node/1183418 and nothing seems to work. I'm also not getting any error messages which makes it harder to debug.

I've attached my custom module code to the bottom of this post.

Any help or ideas are appreciated as I've been stuck on this for over a week now.

    function dependant_keyword_filter_form_views_exposed_form_alter(&$form, &$form_state){
    if ($form['#id'] == 'views-exposed-form-trips-page') {

        if($form_state['input']['field_departure_tid'] === 'All')
            $form['field_arrival_tid']['#disabled'] = 1;
        }
}

function _sort_alphabetically($form, $form_state) {
        foreach ($form_state['view']->filter as $field => $filter) {
            if ($filter->options['exposed']  && $filter->options['id'] == 'field_arrival_tid' ) {
                $field_id = $form['#info']["filter-field_arrival_tid"]['value'];
                asort($form[$field_id]['#options']);
            }
        }
        return $form;
}

function _update_arrival_callback($form, $form_state) {
    return $form['field_arrival_tid'];
}

function _get_associative_array_from_view($viewID, $viewDisplayID, $keyFieldID, $valueFieldID, $contextualFilter){
    $associativeArray = array();
    $associativeArray['All'] = t('- Any -');
    $viewResults = views_get_view_result($viewID, $viewDisplayID, $contextualFilter);
    foreach($viewResults as $viewRow) {
        $associativeArray[$viewRow->$keyFieldID] = $viewRow->$valueFieldID;
    }
    return $associativeArray;
}


texts: Load certain modules only if user is administrator

texts:
I have a number of custom admin modules that deal with site statistics, site management, etc. These are quite heavy and I would like to reduce the site footprint for non-admin users.

Is there anyway to selectively load modules based on a users role? For example, if the user is an admin the load everything otherwise exclude modules admin1, admin2 and admin3.


texts: Separate permissions for form access and form submit

texts:
I have a module on a website, called members, and 2 roles: "low admin" and "manager". They have permissions: 'low admin tasks' and 'manager tasks'. Every low admin has access to both permissions.

There is an edit member form. Manager must be able to view the data, but not be able to update. Low admin can do both operation. Here is the code:

function members_menu()
{
       $items = array();

       //members_edit calls members_edit_form
       $items['members/edit'] = array(
           'page callback'    => 'members_edit',
           'access arguments' => array('manager task'),
           'type' => MENU_CALLBACK,
           );

       return $items;
}

function members_edit_form($form, &$form_state, $data_array = NULL)
{
    //here I prepare the fields
    ...

    //submit button is shown only for the low admin
    if (user_access('low admin tasks'))
    {
        $form['submit'] = array(
            '#type' => 'submit',
            '#value' => t('Submit'),
            );
    }

}

function members_edit_form_submit($form, &$form_state)
{
    if (user_access('low admin tasks'))
    {
        //save to the database
    }
}

Is it possible to remove the condition from members_edit_form_submit and set somewhere (maybe in members_menu), that only users with 'low admin tasks' privilege can call members_edit_form_submit?


texts: How can I be notified when a migration fails?

texts:
I execute migrations everyday with drush in a bash script but sometimes one migration or more fails. Other times the migration ends with 0 created, 0 updated, 0 failed and 0 ignored. I would also like to be notified of this.

How can I be noticed without watching the logs? Is there a hook or a plugin that runs when the migration ends?

It would be perfect if a mail is sended when the migration ends with an error or the migration ends empty (0 created, 0 updated, 0 failed and 0 ignored).

Note: I was thinking on a hook that executes when the migration is finished. Then I could check the migration and send an email if there were an error.


texts: Use getclicky to have most views nodes on home page

texts:
I have installed the getclicky module and I can see the stats most views content.
How can I add that info in a view on my home page and list the top 10 nodes?
I cannot use the Statistics module.


texts:
I've a website that I didn't build that is giving me some trouble. A whole Content Type is returning "access denied" error when authenticated users try to view it (Guests can).
The access is only denied when a field is set to 1, but the are no dependencies set. I really can't figure out from who the access is beeing denied.

I didn't find any access content modules.

Has somebody any ideas?


texts: How do you get template preprocess functions to fire on hook theme suggestions?

texts:
If you have a theme function like theme_field() for instance. I know you can do something like this:

function THEMENAME_preprocess_field(&$varialbes) {
  dpm($variables);
}

and that will print out the all the variables (if you have Devel enabled). Then I see theme_hook_suggestions like this "field__field_date__featured_event". However, when I try to do this:

function THEMENAME_preprocess_field__field_date__featured_event(&$varialbes) {
  dpm($variables);
}

The above does not work at all. Why is this? Is it possible to use a preprocess function on a theme suggestion? or are theme suggestions just for theme overrides and not for preprocessing?

thanks!


texts: Is using nodes for a notification system a performance concern?

texts:
I am building a user activity notification system whereby each new notification message is created as a new node which is displayed by Views. To prevent an infinite number of nodes being created there is a system in place to delete notification nodes once they have reached a certain age.

This still begs the question however of whether using nodes in this way is a good idea for future performance. If a single user gets 20 notifications in a day, that is 20 nodes; now if there are potentially several hundred to a thousand users that is a lot of nodes in a short period of time. The main reason I use nodes is because they are easy to access and manipulate using Rules and also are very flexible when used with Views.

Therefore is it worth considering an alternative to nodes and if so what? The Messaging module comes to mind, but since each new Message is a new entity I'm not quite sure whether in terms of performance this would be any different to using nodes. Is there a module that offers the same flexibility of nodes but also has better performance?


texts: How to make radio buttons required and have a possible default value

texts:
I have a set of radio buttons. I first check the database to see if one of the options has already been set for the user and if so add it to $attending. If none have been set I don't want a default value. I thought I could achieve this by setting default_value to false. The problem I have is that when setting default_value to false and I submit the form without selecting an attending option, Drupal does not give me an error saying I didn't select an option for that radio group. How do I set a default value to nothing so that Drupal gives an error when I try to submit without selecting an option?

$form['attending'] = array(
  '#type' => 'radios',
  '#title' => t('Will you be attending?'),
  '#options' => array(
    '1'   => t('Yes'),
    '0' => t('No'),
  ),
  '#required' => TRUE,
  '#default_value' => isset($attending) ? $attending : false,
);


texts:
I'm new to twig and drupal 8 and finding it hard to access page titles. I want to apply a class to a page title on certain pages, all of which share a sub-directory in the URL path. I'm working with a page-title.html.twig file and want to do something like this:

{{ title_prefix }}
{% if title %}
  {% if <url contains "/services/"> %}

{{ title }}

  {% else %}

{{ title }}

  {% endif %}
{% endif %}
{{ title_suffix }}

I'm assuming this is possible, I just can't figure out how to check the URL for the desired string.


texts: Search text field shifts down to new line in Nav block

texts:
I enable the search module "core module" and then I place the search block in the Navigation region of my Bootstrap subtheme. In Firefox it renders it correctly. placing it just to the left and in-line with the "My Account" and "Log out" links - in the upper right corner of my site. When I view it in IE or Chrome the search text field and search button fall below those links and increasing the height of the Nav section of the site. I would like it to be in-line as it is in FF either before or after the "My Account" and "Log out" links. I have not tweaked any CSS. Can someone please be kind enough to assist me. I am still a noob at Drupal and Bootstrap so forgive me if this is this is an easy fix but not apparent to me. You're assistance would be greatly appreciated.

Please let me know If further info is needed in order to troubleshoot.

Kind Regards,
Evan


texts: How do I create a new Slideshow in the header?

texts:
I've inherited a site with a functioning Slideshow. I haven't been able to figure out how that appears on the site. And I'd like something similar to the functioning Slideshow in the header and have been unable to get that to work. The functioning Slideshow is comprised of:

A Panel Node with content:

View: Slideshow: Slideshow Block
Welcome Message Block
View:Featured Articles: Featured News Block
Home page mini

None of the objects, that I have been able to find, are set to appear (any place I can find), yet the home page shows all the appropriate stuff.

I've tried creating a new Panel Node with all the same content and it doesn't appear. I've tried creating a New Slideshow Block and putting it in the Header Region and the first image appears without rotation.

I'm confused and would appreciate some guidance.


texts:
I'm very beginning to the Drupal. I created on role from my admin part, I need to access the roles with some permissions like i listed below.

My concept is ticket raising system in various categories. As an admin I assign some ticket to some roles(user), now how to give permissions to assign roles(user)?

Also, the assigned user have to do action what they have to do, but they don't have permission to access admin part. How to give permission to the user to do the reply?


texts: How do I reproduce this SQL with Drupal 7's query builder?

texts:
SELECT * FROM mytable
WHERE ('myfield1' = 'someval1' AND 'myfield2' = 'someval1')
   OR ('myfield1' = 'someval2' AND 'myfield2' = 'someval2')
   OR ('myfield1' = 'someval3' AND 'myfield2' = 'someval3')

I'm trying to do this with a foreach() loop:

foreach($mywords as $w)
{
  $myquery
    ->condition('myfield1', $w)
    ->condition('myfield2', $w);
}

Each iteration of the loop, however, should add the next set of conditions.


texts: Using Views for a custom table with multi-value fields

texts:
I have a custom table with two columns - the primary is simply entity IDs (nids), and then there is a data column, but it it can be a multi-value (from 1 to anything).

How can I structure the MySQL table and create a view that will blend a list of entities (nodes in my case) with data from the custom table without losing their multi-value character (probably using relationship)?
Basically I need to achieve that next to a node with a given field I can also show data (separated by commas or otherwise) from the multi-value column from my custom table.

There is some excellent help about doing this with single-value columns at Using views with a custom table/schema but I guess it is a bit more tricky with multi-values.


texts:
I'm building a views that has a PHP field with  SQL queries.
I wondering if I can get the date filter value to use it in my select statement?


texts:
I'm currently trying to translate my twig template to the current language and at this moment I'm getting the following error

  InvalidArgumentException: Invalid translation language (fr) specified.
  in Drupal\Core\Entity\ContentEntityBase->getTranslation() (line 872 of
  /Applications/XAMPP/xamppfiles/htdocs/iom/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Here is a snippet of code that I'm currently working on

// Page-level pre-processing
function iom_preprocess_page(&$variables) {

    $language = \Drupal::languageManager()->getCurrentLanguage();
    $variables['lang_code'] = $language->getId();
}

{% if (language.getId() == 'fr')  %}

{{ tab_label.entity.field_tab_title.entity.translation('fr').label }}

{% else %}

{{ tab_label.entity.field_tab_title.entity.label }}

{% endif %}

Somehow this part right here is what seems to be causing the error even though the language is currently correct

{{ tab_label.entity.field_tab_title.entity.translation('fr').label }}


texts: How to display a percentage for a pie chart label using the Charts module?

texts:
I'm using the Views integration of the Charts module, with HighCharts as the charting engine.

I want to create pie chart, in which I want to also get the percentage displayed when I hoover over any of the pie slices. I cannot find any specific option to do so.

Anybody any suggestions to get this to working?


texts: hook_views_pre_render() to override results of a view

texts:
I have a view used on a site to show the latest 4 nodes (in teaser mode) of a content type of 'article'.

On some Article pages the administrator can override some or all of the 4 nodes to be shown in this view.

I have an entity reference field in this content type where they can optionally select up to 4 nodes to feature instead, then in my template.php I have the following code:

function adaptivetheme_subtheme_views_pre_render(&$view) {
    if($view->name == "related_articles") {

        if ((arg(0) == 'node') && is_numeric(arg(1))) {
            $node = node_load(arg(1));
        }

        if(isset($node) && $node->type == 'article') {

            foreach($node->field_related_articles['und'] as $key=>$override) {
                if(!empty($override)) {
                    $view->result[$key]->nid = $override['target_id'];
                }
            }

            dsm($view);
         }

       }
}

I can see in the DSM output that the values in the results array of the view are changed correctly, but the actual rendered view has blank spaces in place of the inserted nodes.

Where am I going wrong?


texts: how to create a module that declare a block that contains a link to a specific page using l() function?

texts:
I want to add a block that contains a link to a specific page.
this is can be created using the l() function but it must be declared in a module,So i created a module with two files .info and .module.
I know that .module file must contain the l() function but have no idea about hooks that i should use .
thanks for any help .


texts: How to assign user with civicrm membership to specific role?

texts:
I'm using D7 CiviCRM 4.4.6.

There are two roles in my site: authenticated user, member.

Those who registered in my site is authenticated user.
Only users who have active civicrm membership will assigned to both user and member role.

How can I configure the system so that when it run cron, those who have civicrm membership will be added "member" role?


texts: line break or second row for single record in view?

texts:
I'm using views2 in Drupal 6. I have a view for a custom table. One of the column is called 'notes', which is a textarea. Most of the time it's blank, but sometimes not.

I would like to have it so that if there is a value in the notes column, instead of displaying it in the column, it would add a line break or another row underneath the normal values, like this:

+-------+-------+-------+-------+
| col 1 | col 2 | col 3 | col 4 |
+-------+-------+-------+-------+
| val 1 | val 2 | val 3 | val 4 |
+-------+-------+-------+-------+
| val 1 | val 2 | val 3 | val 4 |
| this is a note.               |
+-------+-------+-------+-------+
| val 1 | val 2 | val 3 | val 4 |
+-------+-------+-------+-------+

Is this possible to do with built-in views functionality, or is there a module that can accomplish this?


texts:
I use Excel Serialization to export views data on Excel. The exported file (xls or xlsx it doesn't matter) adds a hidden apostrophe in the beginning of every date cell ('08/07/2011) which can be seen only on the input line. This leads to wrong column sorting. The cell format is Number instead of Date and this probably causes the problem.
There is a workaround to remove the apostrophes from the whole column, but I want to have the cells without it from the beginning. Is there any way to do this? Maybe by formatting the column before the export? No support from the module maintainers. Any ideas?
Thanks.


texts: Advanced CSS/JS Aggregation Module Breaks My Site Layout

texts:
When I enable my module Advanced CSS/JS Aggregation it breaks my site layout.  Is there something I need to do before or after when enabling this module.

To fix the site layout I need to disable the Advanced CSS/JS Aggregation module and it works again.


texts: How do you view the query that a 'View' is using to gather data from the database?


texts: Create user accounts from a content type

texts:
I have Drupal 7 website. Initial requirement was to accept membership from public (anonymous users) without creating a user account. So the plan was to create a content type called ‘membership’ that has the fields Name, email address, mobile number, a unique alphanumeric ID and other fields for personal/professional details.

Now the requirement is changed and need to create a user account for each of this ‘membership’ type of content.

Is there any way to create user accounts from each of existing content of the type ‘Membership’ by fetching email id from the ‘email field’ and password from the ‘unique alphanumeric ID’ field (or some other means)?


texts: how to make field of type view in views align horizontal?

texts: There is no option for field type view in views to align horizontal like there is with the image field so does anyone know how to force it horizontal with css- what to call it before floating left? where in source it is:


texts: Adding Contextual Links to Ctools Custom Content Type Plugin

texts:
Ctools custom content type called Custom Panes shows contextual links when you have access permission and you hover over the pane (much like a block shows the contextual links) which allows you to easily configure the content of the pane.  After creating my own plugin that is similar to Custom Panes content type (with a few custom fields), I noticed that I do not have contextual links when I hover over my custom panes. I'm wondering if I can set that in the $plugin definition to show contextual links or what the work around would be.  I found the template function the panels uses to template_preprocess_panels_pane(&$vars) which actually looks for $vars['content']->content['#contextual_links'].  I'm wondering if there is a way to add contextual links to custom ctools content type plugins?

Any advice would be great!


texts: View of nodes grouped by tag including not tagged elements

texts:
My feature includes custom code, some views, content types and a taxonomy vocabulary.
An overview page should list all contents grouped by their taxonomy term (tag). The first group should be "not tagged".

How do I add the "not tagged" group?


texts: How to realize ajax on a form element with autocomplete

texts:
I have a form textfield element, which contains autocomplete feature using #autocomplete_route_name.

Could you clarify me, how to call ajax function when the textfield value has been set via autocomplete ? That is, for example, an user has selected a value from the autocomplete list, set it into the textbox and right away something should be executed via ajax depending on new value of the textbox.

Which ajax event should I use for it ?


texts: php.ini opcache path for multiple websites with shared code base

texts:
I have a D9 website set up already and I want to add another that shares the same code base.  (This is on a shared hosting environment)
Below is an example my current php.ini settings for the opcache with 'MyWebSite1.com' as the initial website cache directory path.  I want to have the two sites cached in different directories.
How do I specify the path in this php.ini set up for the second 'MyWebSite2.com' website?  Or, does this cache directory contain generic php info that can be shared between multiple sites so that only one directory can be specified?
Thank you.
date.timezone = 'America/City'

zend_extension=opcache.so;
opcache.enable=1;
opcache.memory_consumption=32;
opcache.interned_strings_buffer=8;
opcache.max_accelerated_files=3000;
opcache.revalidate_freq=180;
opcache.fast_shutdown=0;
opcache.enable_cli=0;
opcache.revalidate_path=0;
opcache.validate_timestamps=2;
opcache.max_file_size=0;
opcache.file_cache=/AbsoluteDirectoryPath/sites/MyWebSite1.com/.opcache;
opcache.file_cache_only=1;


texts: Captcha doesn't come out in my multiform webform

texts:
I have a multiform webform with 3 steps. Why can't I seem to get the CAPTCHA to appear at the end of the form, even when I've already checked Add CAPTCHA administration links to forms? Am I missing anything?

I am using Drupal 7 and Captcha 7.x-1.0-alpha3.


texts: Add comments to Webform Submission pages

texts:
We use webforms for a variety of purposes such as feedback questionnaires, contact forms and request forms.

For the request forms we would like to attach comments on the submission page. This is so after the form has been submitted the User and admins can communicate on the follow up from the Request.

From what I understand the submissions pages are unique and only viewable to users who submitted them OR admins.

Anyone have any idea how I could attach unique comment forms to these submissions individually so that only the User who submitted the form and the admins can comment? Would this require a module or is this something which can be a theme override in template.php?


texts: I need help grouping links under one title

texts:
So this is how my webpage looks at the moment.

However, I need to group each of these links under a certain title.
The titles are the following (bolded):

How do I get each of those links, for ex "Bon Appetit", "Brubakers" to be under the title "Eateries" and so on. How do I create the Group titles?
I just want to know how to get started on it. Do I have to do some coding? (I have no experience on this, by the way.)


texts: Drupal admin links broken for site when using WAMP (e.g. localhost/test2/admin/content)

texts:
I decided to try out the newly launched Drupal 8. After resolving some issues I finally got the installer up and running (using WAMP), and arrived onto clean homepage of my test site.

the problem here is that clicking on any Admin menu links at the top of the page takes me to a Page Not Found... Anyone know if this has been reported among other users and if there is a fix for this?


texts:
I am searching for a solution for past few days but can't find it :(

I have exposed a node with rest api views and there's a couple of field collections inside my node which i want to access over API but the api is retuning field collection IDs not the actual data. How can i get the values of field collection without sending aother request to api for values?

"field_custom_data": {

"und": [

 {
   "value": "3",
   "revision_id": "3"
 },
 {
   "value": "4",
   "revision_id": "4"
 },
 {
   "value": "5",
   "revision_id": "5"
 },
 {
   "value": "6",
   "revision_id": "6"
 },
 {
   "value": "7",
   "revision_id": "7"
 },
 {
   "value": "8",
   "revision_id": "8"
 }
] },


texts:
I have a Drupal 7 site and the queue table has over 4K records. They are primarily for the "update_fetch_tasks" queue. Is the queue table by nature a temporary place holder?

I would like to clean it out and see if it fixes some issues that I am experiencing with the update module. I've done some digging on the queue module and from what I can tell is that proper usage is to claim the queue items and when you are done with them you should delete them. So it seems odd that a core module is leaving records in the queue.

Is there any harm in removing records from the queue?


texts: How do I remove the arrows from the breadcrumbs?

texts:
How do I remove ">>" from the breadcrumbs?

I need to remove those characters because in my site, the breadcrumbs appear like in the following screenshot.

This is the code that generates the breadcrumbs.

$temp = "" . $title . "
";
$breadcrumb = str_replace("
", $temp, $breadcrumb);
print($breadcrumb);


texts: Getting a custom view of Twitter and Facebook posts

texts: I would like to display my client's twitter and facebook posts in a most-recent format in a custom view or block that will be implemented on their site. I was thinking of using the Feeds module, but was told by someone on twitter that cURL was the way to go. Giving these elements custom styling and keeping them listed by timestamp (not type of aggregate) is very important to me, and I was wondering about how to get this done.


texts: Math Field doesnt recalculate when fields are populated

texts: I have 2 Select list(Integer) fields and I am using Math Field to get the sum of the two fields. But when I populate the first value the field is calculated and when I populate the second field it does not recalculate. Help me please.


texts: Modal form with CTools opened in several different pages

texts: I have a working module which opens a modal form with CTools. However, I must use the URL example.com/mymodule/page . There the module creates the link which opens the modal window with the form. How can I use the link in other pages? I have tried to just put the link and it does not work, it redirects to the page of the link (example.com/mymodule/nojs/) instead of opening the modal window.


texts:
I'm trying to use Behat and Drupal for BDD, but I'm running into some authentication issues. Simple steps like:

Given I am logged in as a user with the "administrator" role

Fail because I'm using Drupal's CAS module, which essentially customizing the /user/login page. Any idea on how I can get past custom login pages with Behat?


texts: Conditional clauses with Entity field Query

texts:
I have a syntax issue on using conditional clauses with EFQ, but the documentation on drupal.org is a bit unclear for me. I have google the whole Internet for this with no results at all. My hook implementation is based on another drupal.stackexchange question

The code works for a single ->fieldCondition but when I try to implement the hook below,

    $query = new EntityFieldQuery();
    $entityFormSubmissionIds = $query->entityCondition('entity_type', 'entityform')
      ->addTag('or')
      ->execute();

  /**
  Implements hook_query_TAG_alter

  @param QueryAlterableInterface $query
  */

function mymodule_query_or_alter(QueryAlterableInterface $query) {
 $or = db_or()->condition('field_a',$term->tid)
       ->condition('field_B', $term->tid);
    ->condition($or)
    ->execute();

Fatal error: Call to undefined method DatabaseCondition::execute()


texts: Is it somehow possible to import the user ID with feeds. The GUID field is not the ID field, as I just found out, but I need my user IDs with my imported users to stay the same.


texts: I am using imagecrop module for imagecrop field. but it is not working in touch deveices like ( ipad ). There is any best module for image crop in touch devices?. please help me.


texts:
I am looking to creating a progress bar on which it is displayed how far you are between role 1 and role 20 (Role names: Level 1 - level 20)?

I take it I would have to use some php or javascript with a hook into the specific users role.

Any ideas on how to go about this?

Cheers,


texts: Drupal and Git workflow using Acquia cloud

texts:
Currently i have my central repo (origin repo) on a Bonobo Git Server.

I have followed those steps to use Acquia Cloud with a remote repository.

On my Acquia cloud repo i installed Drupal 8.

also i already cloned my origin repo (Bonobo Git Server) locally to my computer.

Now i think the best workflow is to clone the Acquia Cloud repo locally isn’t it? With the whole Drupal 8 core and all files from the Drupal 8 installation.

So after that i can add contributed modules and themes to my local repo and commit and push them to my origin repo (Bonobo Git Server) and the Acquia Cloud repo?

Is this the a correct workflow? And how do i get all the Drupal 8
files from Acquia Cloud to my local repo?
i have read also something about 'Translating your root directory with git subtree' in this article. Is this correct and what do i have to do exactly regarding my workflow
Is it advisable to use Acquia dev desktop also?


texts: Webform multiple files with descriptions

texts:
D7: I am looking at building a competition section on a site I'm working on. Originally I started looking at Webforms to do this, but there are requirements I have that Webform doesn't solve (as far as I can tell).

What I need is to allow entrants to submit images. There must be at least 5 and no more than 12. Each image submitted should have a title, a caption and a date (dd/mm/yyyy). This is a big problem because I can only find two modules that allow for multiple file uploads in Webforms, neither allow specifying a minimum number of files and neither allow text fields and a date to be entered with each image.

Does anyone know a way I can solve this in Webform or do I need to look at building something custom? It's a pain that I can meet 80% of the requirements out of the box (kinda).


texts: Composer.json deletes dir even with preserve path

texts:
I am running composer on Drupal 7 and I am just trying to update my site; however when I run composer update, the composer deletes all the preserve paths I had specified.

My structure is as follows:

composer.json

composer.lock

web/

    -sites/default

in my composer.json I have as follow:

{
...
"repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/7"
    }
],
"require": {
   ...
},
"conflict": {
    "drupal/core": "8.*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
      "sort-packages": true
},
"autoload": {
    "classmap": [
        "scripts/composer/ScriptHandler.php"
    ]
},
"scripts": {
    "pre-install-cmd": [
        "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
    ],
    "pre-update-cmd": [
        "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
    ],
    "post-install-cmd": [
        "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
    ],
    "post-update-cmd": [
        "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
    ],
    "post-create-project-cmd": [
        "DrupalProject\\composer\\ScriptHandler::removeInternalFiles"
    ]
},
"extra": {
    "installer-paths": {
        "web/": ["type:drupal-core"],
        "web/profiles/{$name}/": ["type:drupal-profile"],
        "web/sites/all/drush/{$name}/": ["type:drupal-drush"],
        "web/sites/all/libraries/{$name}/": ["type:drupal-library"],
        "web/sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
        "web/sites/all/themes/contrib/{$name}/": ["type:drupal-theme"]
    },
    "patches": {
        "cweagans/composer-patches": {
            "Call the preserve paths hooks" : "https://github.com/SebCorbin/composer-patches/commit/1cb9bacba51f8bba0c5f3f322c3bb61e4ceae974.patch"
        }
    },
    "preserve-paths": [
        "web/sites/all/drush",
        "web/sites/all/libraries",
        "web/sites/all/modules/contrib",
        "web/sites/all/modules/custom",
        "web/sites/all/modules/features",
        "web/sites/all/themes/contrib",
        "web/sites/all/themes/custom",
        "web/sites/all/translations",
        "web/sites/default"
    ]
}

}

What ends up happening is it install the core and modules correctly in web/ folder, but deletes all the preserve paths as well. Any suggestions as to why i am having this problem? Thank you.

I have tried to put composer.json in the web/ folder as well, that just imports all the require modules and core in a subfolder (web/web/).

I am now getting:

Files of installed package were overwritten with preserved path x/web/sites/default!

Files of installed package were overwritten with preserved path x/web/sites/all/libraries!

and the preserve paths didn't do anything.


texts: How to Begin a French Version of My Site?

texts:
I have an English site at the moment. I'd like to start a French version of it, but I get a bit confused when I look at the options out there. I am running Drupal 7.

Here's what I'd like:

When you go to example.com, it is in English. When you go to example.fr, it is in French.
There should be an option to switch from English -> French or French -> English, redirecting to the appropriate domain.
Some nodes on the English side will not have equivalent nodes on the French, and vice-versa. Some will, and some will not.
I wonder if it's possible to have different settings per site? For instance, I have a social media module that has icons for following on Twitter/Facebook etc. I'd like to have the French site show the links to the French versions of those, like my French FB page.

What would be the best way of doing these things?


texts: I'm trying to modify the text that shows on the standard Access Denied page.  I created a module and tried to extend the core class but while module installs fine the page does not get modified.  My first question is can Access denied be customized?


texts:
I'm working on a module that shows a different frontpage per role. I have three frontpages:

the base www.domain.nl for anonymous users, set in the basic site settings
for users with role_1 they go to sub1.domain.nl\dashboard
for users with role_2 they go to sub2.domain.nl\dashboard

I'm almost there but the frontpage url is set in cache (I think) therefor when I login I get the right frontpage. So I have role_1 en go to sub1.domain.nl. Now when I logout I want to go back to www.domain.nl but I still get redirected to sub1.domain.nl. Even when I close the browser and return to the site I still get back to sub1.domain.nl.

So my question is how can I make sure this response is cleared from cache after loggin out or is not even cached at all? What is the best method to deal with this?

My code till now:

mymodule.services.yml

services:
  mymodule.event_subscriber:
    class: Drupal\mymodule\EventSubscriber\FrontpageSubscriber
    tags:
      - {name: event_subscriber}

src/EventSubscriber/FrontpageSubscriber.php

<?php

namespace Drupal\mymodule\EventSubscriber;

use Drupal\Core\Routing\TrustedRedirectResponse;

use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class FrontpageSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public function checkFrontRedirection(GetResponseEvent $event) {
    $current_path = \Drupal::service('path.current')->getPath();
    $front_uri = \Drupal::config('system.site')->get('page.front');
    $front_alias = \Drupal::service('path.alias_manager')->getAliasByPath($front_uri);
    $current_alias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
    $isFrontPage = \Drupal::service('path.matcher')->isFrontPage() || $front_alias === $current_alias;

    if ($isFrontPage) {
      $hasRole1 = \Drupal\user\Entity\User::load(\Drupal::currentUser()
        ->id())->hasRole('role_1');
      $hasRole2 = \Drupal\user\Entity\User::load(\Drupal::currentUser()
        ->id())->hasRole('role_2');

        if ($hasRole1) {
          $domain_url = 'https://sub1.domain.nl/dashboard';
          $response = new TrustedRedirectResponse($domain_url);
          $event->setResponse($response);
        }

        if ($hasRole2) {
          $domain_url = 'https://sub2.domain.nl/dashboard';
          $response = new TrustedRedirectResponse($domain_url);
          $event->setResponse($response);
        }
     }
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = array('checkFrontRedirection');
    return $events;
  }
}


texts:
So i wrote a lot of custom code which is executed form custom drush commands from the command line/terminal, works fine, but now the client changes his mind and want to execute the code from the UI, the admin panel.

Is there any way i can run those drush commands from that level or not?

Thanks,
Will


texts: What causes 'You are not authorized to access this page' during create/edit of any menu?

texts:
I got a very odd error for "new" admin user on Drupal 7. There are a few admin users in this site but only the "new" one that is unable to create, edit or list links on any menu. The error message is like so:

  You are not authorized to access this page

But this new admin user has the same role as other admins.

Does anyone know what can causing this?


texts: "The website encountered an unexpected error. Please try again later."

texts:
I get this error with Drupal 7.

  The website encountered an unexpected error. Please try again later.

How can I get more information about this error? Is there any report or log to understand what happened? The PHP log doesn't report errors.
How can I disable that message and have a more useful one for debugging purpose?


texts:
I would like to be able to hide a specific user profile.

I want to completely hide it from Drupal and search engines. How can I achieve this?


texts:
I'm trying to theme a field in a complex view that was setup by someone else.

We have three node types: Location, Candidate, Survey
(A location has many candidates, a candidate has 1 survey - but a survey can have more than 1 candidate)

My question is basically, when viewing the Location node, I can get the survey, but not the Candidate:

$survey_node = node_load($row->{$field->field_alias});
$survey_wrapper = entity_metadata_wrapper('node', $survey_node);

$candidate_wrapper = ???

Some background
When viewing a location node a table view lists candidates across the columns and their survey results.
(The view has been setup by someone else and I am not entirely sure how it has been configured to look this way).

I'm trying to customise the Field that displays the candidate name by overriding the view template.

I've overridden the template, but can't figure out how to traverse the relation and get the data I want

Here's the sticking point, a survey may have more than 1 candidate associated with it - so when traversing from the survey node back to the candidate, how do I make sure that it's the candidate for the electorate?


texts: Why are some menus created for authenticated users not displaying?

texts:
Whatever menus created for authenticated user, some menus are displaying and some created menus are not displaying.

If I login as admin, it shows all created menus and its child menus.

Why is this?


texts: How to add as exposed filter a product attribute in Commerce's orders view?

texts:
I have a drupal 8 commerce website.
The Orders page is a view that comes with commerce where all the orders are listed.
Is it possible to add/create ( on the website or programatically ) an exposed filter based on a PRODUCT ATTRIBUTE to show all the orders containing a value of that product attribute?

For example: for a product attribute called ORIGIN, I would like an exposed filter in the orders view that would allow me to choose between 2 values: Los Angeles or San Francisco.

Some orders will show up in both because they will have different products with different ORIGIN value product attributes.

I tried to modify the orders view but I couldnt find any product attributes nor a relationship to products. I tried to add a relationship to order item but that didn't help expose any of the product attribute fields.


texts:
Is it possible to load a block contents into a template file (say like page.tpl.php)? I need to extract a block which contains colophon (e.g. copyright and company information) and place it after the footer region.

Also, are there any performance problems with this approach?


texts: How to customize the display of a block?

texts:
I'm new to drupal, I'm using Finder module, I was able to hide some buttons and clean the presentation a little bit, but I also want to be able to customize the search fields display, I'm not sure if I will have to develop a module and implement a certain hook or this should be done in the template.

here's how the block looks like :

I'm trying to inline those input fields and add some style to them and my question is how can I achieve this.


texts: Two Errors Lumped Into One - File Field Deleted - Cannot Be Found/Deleted/Recreated

texts:
I'm in the process of adding more content types/cleaning up old ones on my site. Except I keep coming across an error that has another part which seems to differ from other questions posted to this site.

I deleted a field because it had become obsolete, named "Site Document Attachment" which was a file field. Now whenever I make any change to the site, this error puts it on hold:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table
'cocempro_portal.field_data_field_site_document_attachment' doesn't exist:
SELECT field_data_field_site_document_attachment0.entity_type AS entity_type,
field_data_field_site_document_attachment0.entity_id AS entity_id,
field_data_field_site_document_attachment0.revision_id AS revision_id,
field_data_field_site_document_attachment0.bundle AS bundle FROM
{field_data_field_site_document_attachment}
field_data_field_site_document_attachment0 WHERE (field_data_field_site_document_attachment0.field_site_document_attachment_fid
= :db_condition_placeholder_0) AND
(field_data_field_site_document_attachment0.deleted =
:db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 1552
[:db_condition_placeholder_1] => 0 ) in field_sql_storage_field_storage_query()
(line 652 of /home/cocempro/public_html/portal/modules/field/modules
/field_sql_storage/field_sql_storage.module).

And I did double check to make sure there weren't any tables named that in my MySQL database, as that happened to me once before - and the field isn't listed in my field report. And playing the easy way out, I just tried to recreate the field in the exact same way, but that came back stating that the machine name was already in use.

So where to I go from here? I'd appreciate any help anyone might be able to offer in regards to this problem, because I'm not sure where to go at all. Thanks


texts: Drupal Core Bartik Theme - Pager Problem

texts:
URL: /admin/store/products/attributes/

Uber:7.x-3.8      Drupal:7.37

i haven't this problem with older Drupal versions
When I check my att list page in Ubercart with Bartik core theme I see:

<table class="sticky-header" ....

....

but in Garland theme i have pager

<table class="sticky-header" ....

....

Pages

1

2

3

next ›

last »

I tried replacing template.tpl.php or node.tpl.php or page.tpl.php markup. And tried  tracing for item-list without finding the cause of the issue. Any idea how to get the pager in the Bartik theme?


texts: Custom template for displaying inner blog contents

texts:
I am trying to create a custom layout for my blog listing and blog content display pages.

The following url will display all the latest blogs based on the conditions that I have set.

http:///general-blog

When I click on the 'Read more' button corresponding to a button, it will display the full blog contents in another page.

Sample format : http:///general-blog/tourist-details

I am able to modify the layout of the page corresponding to blog listing. For this, I have created a custom tpl file : page--general-blog.tpl.php.

What I want is to create a new template file for displaying the contents of individual blogs.

The individual blog content display page is not entering - page--general-blog.tpl.php file. It's always using the template - page.tpl.php.

I tried creating separate tpl files like :

page--general-blog--%.tpl.php

But, the changes in this template is not getting effect in the individual blog content display page.

How should I move forward. Has someone had any similar situations?


texts: Problems primary links translate drupal 6

texts:
I have translate the link in my menu (primary links) in spanish, when i change the language from italian to spanish all the voices of the menu are translated except one ( the voice apartamentos) that is not visible but is right activated and setting as the other links.
Do you know something?


texts: Should I use the JSON:API include module or let the front application handle the related entities display?

texts:
to get a related entities using the json:api I can use ex: ?include=uid,uid.user_picture in the parameter, and all the related entities will be returned in the included object, then the front application needs to apply some logic to get the entity(ex: node)+ related entity fields (ex: author email) and then I want to get the author is image , so the front will need to handle a lot of loops, so I have used the JSON:API Include module it works by embeding the relationships one inside another automaticall,but it have some drawbacks so can any one help me to figure out what is the best solution ?

without JSON:API Include module :

  the json HTTP response size will be smaller,also the json structure respect the JSON API specification which  make it more stable and understandable(relationships , included..)
  but the processing in the front application will be heavier if we have
  a lot of relationships.

with JSON:API Include module :

  easy processing for the front application but the json HTTP response size will be bigger ,and the JSON:API specification will be broken(no relationships or  included object all will be shifted into the data object).


texts:
I've installed a theme on my site, and can't figure for the life of me how to extend the theme to different content.

For example, comments are themed on the blog pages; however, when I add new content types with comments, the theme is not applied to these comments.

How do I get the theme to extend to the different content types?


texts: Can I avoid creating a new revision of every attached field upon entity save?

texts:
I have created a custom entity with several properties and several attached fields.

When I load a instance of my custom entity, update a property of the entity (e.g UID) and save it a new revision of the entity is created, but also a new revision of every attached field is created.

To avoid saving lots of redundant data I only really want to create a new revision of an attached field if the data in that field has changed.

I've noticed that this same behavior is exhibited by core node objects, but is still not really desirable.

My function which currently saves my entity looks like this:

/**
* Saves a emtr safe check to the database.
*
* @param $emtr_safe_check
*   The emtr_safe_check object.
*/
function emtr_safe_check_save(EMTRSafeCheck $emtr_safe_check) {

    $is_new = isset($emtr_safe_check->is_new) ? $emtr_safe_check->is_new : false;

    // always make a new revision
    $emtr_safe_check->is_new_revision = TRUE;
    $emtr_safe_check->save();

    if($is_new) {
        // now we have the new emtr safe check id lets save the attached fields
        field_attach_insert('emtr_safe_check', $emtr_safe_check);
    } else {
        // This is where my attached fields are saved
        // Can I do something clever here to avoid creating redundant revisions?
        field_attach_update('emtr_safe_check', $emtr_safe_check);
    }

    return $emtr_safe_check;
}


texts: Redirect after logout module doesn't redirect with link

texts:
I'm working with the redirect after logout module to redirect the user to the login page after he logs out.

Now I have a link in my main menu with route user/logout. And my module redirect after logout is configured to redirect to user/login.

But when I click on the link I'm not redirected to user/login but I'm being send to the 'front-page' (I am logged out). And when I surf to mylink.com/user/logout I am being redirected to user/login. Why doesn't this work with the link?


texts: Where to put #Ajax Callback in webform twig file

texts:
I would like to add the Ajax callback settings to my custom composite webform element in the twig file.  Is this possible?  The callback function is in my custom module.  This is NOT a computed twig situation.  The Webform is created entirely from D8 webform GUI.

Custom composite has qty, code, description, price.  Using the callback to verify code and update the description and price.
Could something like below be put in the twig file?

'#ajax' => (
    'callback' => 'validate_srvform_items',
    'event' => 'change',
    'progress' => array(
      'type' => 'throbber',
      'message' => t('Populating line item...'),
    )


texts: Why is libraries-override not removing assets?

texts:
My attempt to remove CSS and JS assets is not working.  I have placed the following declarations in my module's *.info.yml file.  But after clearing the cache, I still see the assets in the head of the document.  Is there anything wrong with my syntax:

libraries-override:
  global-styling:
    css:
      base:
        /themes/stack/css/lightbox.min.css: false
    js:
      /themes/stack/js/lightbox.min.js: false

Here is the relevant Drupal documentation:
https://www.drupal.org/docs/8/theming/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme#override-extend

I also tried these for the key:

stack/global-styling
stack.global-styling

I also tried it without the full paths:

libraries-override:
  stack/global-styling:
    css:
      base:
        lightbox.min.css: false
    js:
      lightbox.min.js: false

Nothing is working so far.


texts: Update user via REST (and under AngularsJS)

texts:
I need to update a user fields via REST SERVICE. I'm under AngularJS, so this is my function into my .service()

setMyUtx: function (params) {
            return $http({
                method : 'PUT',
                url : 'http://XXXXXXXX/rest/user/'+params.uid,
                data : {'data' : params.value},
                headers : { 'X-CSRF-Token' : $cookies['csrftoken'],'Content-Type': 'application/json;charset=utf-8'},
                cache : false
            })
        },

where params.value is :

var data = {};
      data.field_primary_aircraft = {};
      data.field_primary_aircraft.und = [{value:1}];
      ProfileService.setMyUtx({'uid' : $scope.datiUtente.uid, 'value' : data});

If I exec this function, my drupal site return no error with this output:

{"field_primary_aircraft":{"und":[{"value":0}]},"uid":"7","roles":{"2":"authenticated user"}}

But no update is done (I know it because the original value of field_primary_aircraft is 1).

Why this ? Where is my error ?


texts: Display Suite layouts not working for field collections Edit\Add forms

texts:
Even though I have the Display Suite Forms module enabled and applied a layout to this specific field collection, it does nothing for the edit/add forms. If I apply a layout using manage display it works when viewing the appropiate view mode (for example the full view mode).

Does anybody have any idea or hints where I could start looking?


texts: entity_create() call to undefined function

texts:
I wrote the following function using entity_create, but I am getting an error 'call to undefined function'. Is there anything I need to load so that I can use Entity API for my module? I have Entity API already installed but it seems that it is not globally accessible. What I would be missing to have entity_create or other Entity API functions available?

function customisation_add_newsnap($title, $id, $name, $hash, $datetime, $type) {
  $values = array(
    'type' => 'enews_snapshot',
    'uid' => 6,
    'status' => 1,
    'comment' => 0,
    'promote' => 0
  );
  $entity = entity_create('node', $values);

  $ewrapper = entity_metadata_wrapper('node', $entity);

  $ewrapper->title->set(t($title));
  $ewrapper->field_es_id->set($id);
  $ewrapper->field_es_name->set($name);
  $ewrapper->field_es_hash->set($hash);
  $ewrapper->field_es_groupyear->set($year);

  $ewrapper->field_es_type->set($type);

  $my_date = new DateTime('January 1, 2013');

  $entity->field_es_postdate[LANGUAGE_NONE][0] = array(
    'value' => date_format($my_date, 'Y-m-d'),
    'timezone' => 'UTC',
    'timezone_db' => 'UTC',
  );

  $ewrapper->save(true);

  //entity_save('node', $entity);
  _x($ewrapper);
}


texts: Updating $form_state of a form from a different form

texts:
I have a pretty complex process that combines two Drupal forms--1 widget form and 1 normal form.

The first form (WidgetForm that extends the ImageWidget form) will allow the user to open a modal to view some images, like Entity Browser but populated via 3rd party API.  I render the form using the following snippet:

$modal_form = \Drupal::formBuilder()->getForm('Drupal\my_module\Form\ModalForm');

Simple enough, our extended WidgetForm adds a button to 'Browse' images and if clicked, we get a render array and I shove that into an OpenModalDialogCommand and return that so it opens a modal with my form inside.  This works no problem.

The ModalForm form allows the user to browse through images, paginate them, search, etc.  However, when I want to update my WidgetForm, i'm having difficulty rebuilding the $form_state.  Thus, when I submit the form, it is using an outdated $form_state and doesn't recognize that I've tried to manually insert values into the $form array.  I know the following is sufficient data b/c I can populate it on the initial form build with session variables (but the UX is completely messed up if I rely on this process).  But since I want this to be all within the same page request, I don't want to rely on refreshing the page.

$element['#value']['fids'][] = $fid;
$element['#value']['target_id'] = $fid;
$element['#display_default'] = TRUE;
$element['fids']['#value'] = [
  $fid,
];

Above, we insert the $fid into some form fields.  If we do this on the initial page load, it works fine (as I mentioned above).  When I try to do this in my ajax callbacks, it doesn't update the $form_state.  So I've tried to save it as session variables and set $form_state->setRebuild(TRUE) in the validate/submit callbacks so that it will call my build step again which has logic to check for session variables.  If I set $form_state->setRebuild(TRUE) anywhere in my ModalForm, it will only rebuild the $form_state for my ModalForm, not my WidgetForm.  So we arrive at my problem--I cannot seem to find a way to update the $form_state of my WidgetForm.

I've also tried to save the pure $form_state object as a session variable and then update it when necessary but this is not working.

// At the end of my formElement() function on my field widget form
$session = new Session(); // Symfony session
$session->set('my_module.image_widget_form_state', $form_state); // save the $form_state object

// Later in my other form...
$image_widget_form_state = $session->get('my_module.image_widget_form_state');
$image_widget_form_state->setValue('fids', [$fid]); // attempt to update $form_state at a later stage from within a different form

So it seems my problem is that I'm trying to update the $form_state of an active form within an ajax callback propagated by a completely different form.  In other words, I need to update the $form_state of my WidgetForm from within my ModalForm.  Both forms can be 'active' at the same time but ultimately, the WidgetForm needs to be dynamically updated based on actions taken from within the ModalForm.

Also related but not necessarily the main point of this question--despite my best efforts to rebuild the form on pertinent steps, it seems that I'm running into the bug where the #name property disappears and then the Form thinks that every single button is a submit button (when most of the buttons are simply a means to trigger an ajax callback).  Would anyone know how to prevent this from happening?


texts: Webform uploaded files attached two times to email

texts:
I set up a webform with a file upload to the private file system. One field, one file.
I configured the smtp auth module and a mail body with custom values.
I unchecked all values but the managed_file and also checked the checkbox to add files as attachment.
Now everything works fine, but every email sent has attached the file two times. Same filename, two files in the email. I could ignore this, but since the attachments get a bit bigger sometimes, the mails have double the size necessary.
Any clue what I'm doing wrong?


texts:
Shouldn't be hard, but it is - how do you make a CCK checkbox default checked?!?

I've tried various responses in the PHP Default Value box:

return array(0 => array('#default_value' => 1));
return array(0 => array('default_value' => 1));
return array(0 => array(1));
return array(0 => 1));
return array(1);
return 1;

I'm sure you get the point. None of these work?!


texts: How to unset node form select list element_validate?

texts:
I added a built-in select list field to a content type but left the allowed values field setting empty, since I'ld like to get the possible options to choose from dynamically.

To be precise I'ld like to offer the editors a list of files inside a certain directory to choose from. This list can grow and I don't like to touch the content type and adjust the allowed values field setting every time a new file gets added to that directory. (Editing it afterwards may even not be possible since after having values for that field in the database when nodes got added you are not allowed to change field settings anymore.)

So here I am, having the list of files added to the form widget's options array, but now I'm unable to save the selected value as it's not in the list of allowed values.

  The value you selected is not a valid choice.

OK I thought, let's simply uncheck the element validation: unset($form['field_MYFIELD']['widget']['#element_validate']). As far as I can remember this worked in D7. Makes the problem even bigger.

  TypeError: Argument 1 passed to
  Drupal\Core\Field\WidgetBase::massageFormValues() must be of the type
  array, string given, called in
  /Users/Shared/www/Documents/MYREPO/web/core/lib/Drupal/Core/Field/WidgetBase.php
  on line 370 in Drupal\Core\Field\WidgetBase->massageFormValues() (line
  505 of core/lib/Drupal/Core/Field/WidgetBase.php).

Is there a simple way to unset this element validation here? Or should I introduce another custom select list field and save the chosen value into a hidden textfield, simply?


texts: Redirect users on first time login to a particular page

texts:
In my drupal 7 website when a user registers, an email is sent to them. And when they click on the verification link in the email they are redirected to "SITENAME/user" page. I wanna change that. I want the user to be redirected to another page say "SITENAME/upload" page. I have used the user registration password module. The email sent to the user is

[user:name],

Thank you for registering at [site:name]. You may now log in and verify your account by clicking this link or copying and pasting it to your browser:

[user:registrationpassword-url]

This link can only be used once. You will be able to log in at [site:login-url] in the future using:

username: [user:name]
password: Your password

--  [site:name] team

I think I have to change the  [user:registrationpassword-url] part. But Im not sure what to change that to.

Thanks


texts:
I would like to create a custom message when user did unexpected error it should show this message
 Invalid parameter please enter correct values . It should not show this message.
  The website encountered an unexpected error. Please try again later.
I would like to create

 try {
    ...

    }
    catch{
        Invalid parameter please enter correct values;
    }

please help with simple example


texts: Why aren't the main menu and the secondary menu simply regions?

texts:
I noticed that you can put content pretty much anywhere ( where a theme provides regions) using blocks.

This becomes pretty straight forward and makes sense. But then I was trying to find where the "My account" and "Logout" links came from. And after some searching I found out they are configured in the Menus -> Settings admin page.

Now I read the controversy about the misleading help text for the Source for the Secondary links, so this "special" behavior to display secondary links doesn't seem to work anymore in Drupal 7.

So my question is: Why are these "regions", treated separately at all ?

Why not have normal main menu and secondary menu regions ?


texts: change comment form container to textarea

texts:
How to remove the red section in next image (comment form)?

I have try change the type to textarea, but on submit the form a blank page appears.

function THEME_form_comment_form_alter(&$form, &$form_state) {
    $form['comment_body']['#type'] = 'textarea';
}


texts: Selecting taxonomy term in article and showing all articles titles associated with this term

texts:
I have a content type article and when editing an article there should be a field where you can select a taxonomy term of a specific vocabulary.

When viewing the article it should show a list of titles of all articles associated with the selected taxonomy term. I know how to make a select field and also a view to show the titles. But how do I send the selected term to the view and how do I display the view in the article?


texts: How to correctly sort on accented letters when using the Lexicon module?

texts:
I'm facing an issue with the Lexicon module which I still can't figure out.

I have a glossary of French terms, sorted alphabetically. And I notice that the accented letters are considered as different letters and make the words appear at the end of the list.

Example:

Dettes
Dividende
Droit de souscription
Débit/crédit
Dépôt de bilan

I found an issue reported here, that seems to match with my own problem.

I tried to apply the last validated patch, using my .make file like this:

projects[lexicon][patch][] = "https://www.drupal.org/files/lexicon-transliteration_for_lexicon-1275954-13.patch"

And proceeding to a deployment, using phing like this:

phing clean
phing dev-deploy
drush cc all
drush updatedb -y
drush fra -y
drush cc all

But it changed nothing.

EDIT:

The patch is applied correctly.
In the DB, when I sort the terms by "name", it appears in the right order.

Any clue is welcome!


texts: Using REST API for data storage for user definable content

texts:
I might be barking up the wrong tree completely however I am trying to achieve the following.

Drupal 7.
Custom REST web service which can hold user definable content types.

These pieces of content are stored and revisioned at a entity level. (not at a field level like drupal)

I want to be able to use Entity API + Entity Model to define Content Types to store in the REST service.
When inserting DO NOT create the Drupal field tables.

When I hook_entity_insert the field tables are still being created. How can I prevent Drupal from creating these tables.

Also, does this sound like the best way to go about this? Is there an easier way to achieve using REST services and not duplicating data in the Drupal DB?

Thanks.


texts:
I've created a field with drupal console. That made the following standard folder structure.

FieldFormatter
FieldType
Fieldwidget

These all have their respected php classes.

Now this field is in a content type that always is used in a Book.
I want to this Books name into that field.
I know how to retrieve this name trough code but i don't know how to get this value into this field in all new instances of this content type.

I thought i just needed to use a default value but that doesn't seem to work because even though i added 'default' to the schema with that value it doesn't show up?


texts: How do I alter/change the "field is required" message?

texts:
I have below code

$form['name'] = [
      '#type' => 'textfield',
      //'#title' => $this->t('Email'),
      '#size' => 60,
      '#maxlength' => USERNAME_MAX_LENGTH,
      '#default_value' => $form_state->getValue('name', ''),
      '#required' => TRUE,
      '#attributes' => [
        'placeholder' => $this->t('Email'),
        'autocorrect' => 'none',
        'autocapitalize' => 'none',
        'spellcheck' => 'false',
        'autofocus' => 'autofocus',
      ],
    ];

When I comment title it shows blank. I would like to change error message of the required field.

In the validation handler, I tried with this code.

if ($form_state->isValueEmpty('name')) {
  $form_state->setErrorByName('name', $this->t('Email is required.'));
}

It's not showing the error message.

I would like to keep the form element required and alter the error message.


texts: How to create a Content pane view of nodes with common taxonomy terms (creating relared contents))

texts:
I need to create a list of related contents to the current node with common taxonomy terms in Panels. I tried Related Articles - a block view of nodes with common taxonomy terms, it works well with blocks but I have problem with moving this idea to a Content pane display mode.

After following the above method I add Term from node relationships to get the following contexts in the Panels

and it is Argument input configuration of the Views pane

The problem is this View is not available in the Add content -> Views pane section of the panels. But if I remove Argument input configuration it will be available.

How can I create a View pane of the above block that works with panels?