texts: Cancelling user account set draft pages to published

texts:
When we cancelled a user account using the Delete the account and make its content belong to the Anonymous user method, we found that the author was set to Anonymous for the pages they were set as the Author, as expected. The problem is that many pages that were set to Draft were then updated to have their Author set to Anonymous and published, which is not a desired outcome. These drafts were never published and always kept in that state.

We have a view that pulls all pages that are published and content type = Basic Page. This started to pull in all the draft pages because they were set to published after the user account was cancelled.

How can we cancel an account without publishing pages that were are set to Draft moderation state?

Steps to reproduce:

Create 10 draft  Basic Pages (do not publish) where the Author is set to content admin
Cancel the user account for content admin by using Delete the account and make its content belong to the Anonymous user method.
Under /admin/content, observe the pages are now in published state with Author set to Anonymous

Current modules being used for revision:

workbench
workbench_moderation


texts:
function gng_unsubscribe_form($form,&$form_state) {
 $form['email'] = array(
 '#title' => 'Email',

'#type' => 'textfield',
 );
 $form['submit']=array(
 '#type'=>'submit',
 '#value'=>t('Unsubscribe'),
 '#prefix' => '
',
 '#suffix' => '
'
 );
 return $form;
 }

For a particular field I can add custom class using #prefix and #suffix, is there a way to add wrapping div around whole form?


texts: Is there a hook or sth after file is uploaded via file field?

texts:
I have drupal 7 installation with file field + video field(and media module). I can change where to upload files in video field setting(default: videos/original).
I'm trying to do stuff to videos after file is uploaded and node is saved.
Is there a hook I can use to achieve this?

What I want Exactly: Make a copy of the videos to 2 different servers via ftp and some transcode codes. First file needs to be uploaded to drupal folder and after that I need my code to run. sometimes videos need to be converted using ffmpeg(move to videos/converted) and then I run my code.

I've found these hooks but none of theme get called after uploading files or even after saving the node:

hook_file_copy($file, $source)

hook_file_move($file, $source)

how about this one?

hook_field_insert or hook_node_insert


texts: How to alias pages generated by panels (node edit or view pages)

texts:
I have a panel page that is in the form:

"/productsByMfg/%nid" where nid is the node id of the a manufacturer.  This is not a node edit or view page since I already have that.

I have about 100 of these pages /productsByMFg/1, /productsByMfg/2 etc...
How do I create aliases so I can use something like /productsByMfg/IBM, /productsByMfg/Microsoft?


texts:
We have a view for the Basic page content type, which has a Category field that allows to enter multiple values.
All values for Category are displayed (IoT, Cloud, Security), but there are only nodes that use IoT and Cloud. I want to display only IoT and Cloud for the Category exposed filter.

How can I limit the exposed filters to only display values for which content exists?

The view settings are the following.

Format

Show: Content | Teaser
Format: Unformatted List | Settings

Filter Criteria

Authored on (exposed)
Category (field_category) (exposed) | Settings (settings is set to Category tag, selection type = Dropdown)
Author (exposed)
Published (= Yes)
Content Type (= Basic Page)

Sort Criteria

Content: Authored on (desc)

Contextual Filters, Relationship

None

Exposed form

Exposed form style: Better Exposed Filters | Settings
Settings are set to default in Better Exposed Filters

Other

Use Ajax: Yes
Use aggregation: no
query settings: default settings

Here is what we tried. This only gets me the nodes that have a value for field_category and all term values for categories term individually.

function mymodule_form_views_exposed_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  $node_storage = Drupal::getContainer()->get('entity_type.manager')->getStorage('node');
  $node_ids = $node_storage->getQuery();

  // This returns all nodes with a value for *field_category*.
  $nodes = $node_ids->condition('type','page')
    ->exists('field_category')
    ->condition('status', 1)
    ->sort('title')
    ->execute();

  // returns all taxonomy terms.
  $category_tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree('categories');

}


texts:
I have a node with 450-500 fields which I have already splitted in small forms that are being load via ajax.

Anyway, when I get the node form before splitting it, the function _field_invoke (at field.attach.inc) is taking such a long time that makes the server return a timeout. I'm working in a 1 core 2.2MHz 3.5 GB

Is there any way to speed on this function?
Otherwise, what alternatives do I have to speed on the load of a form with 450-500 fields?

EDIT (@Neograph734 comment)

We have a main form with 30 fields, most of them y-n that are used to select sub-forms. The form started to grow as the project was going on, and ended with 10 sub-forms form 30 to 50 fields each one.

We tried to split into different nodes and content types, but we could not find any viable solution: it must be a single document with digital signatures on each form that must be sync one each other, and the whole document follows a status that enables signatures to certain users (when a user has signed every signature field in all sub-forms, then the next user can start to sign). But in fact this is not the question here, as even if there were a better solution, we have no budget now to refactor the whole project, so we have to deal with a form of ~450 fields.

Right now we have rewritten drupal_build_form functionality to store every prepared sub-form in the cache and load them via ajax. So when a user requests the complete node, we give them the whole node but just the first 30 fields are rendered. We provide empty hidden <div>'s that will be filled via javascript with corresponding sub-forms, on demand.

Basically we keep the forms obtained after drupal_retrieve_form, drupal_prepare_form and drupal_process_form on the cache, but we assign a known cid and we store it via  cache_set, so later on we can recover them, remove the fields that we don't want to render, render it and deliver it via ajax. In this way we do not render the whole form at once, but we do it on demand.

At first time we tried to remove the fields that were not going to be used by the user, but we found that we could not submit the form: Drupal said that there were missing fields (when a node is saved, the form must be submitted with all fields, even if they are with an empty value, otherwise it raises an error on node save).

So basically what we are doing is:

Node load (get via browser or ajax) -> look in cache_form table if we find pre-cached form or sub-form, their cid are like form_form-petra_node_form-p0, form_form-petra_node_form-pa, etc... and form_state_form-petra_node_form-p0 and so on.
If we find the pre-cached form, we load it and pass it through drupal_prepare_form, we remove not caching keys (form_state_keys_no_cache()) and then drupal_process_form. This is mostly the same as drupal_build_form does. Then we save the new form to cache_form (with cache_set, an expire time of 3 hours and a random generated cid as it would do drupal_build_form) in order to recover it later in post phase. If this is a sub-form, we merge the rendered sub-form with the parent one obtained via browser get (ajax is in charge of doing so).
If the form is not there, we prepare it from scratch and save it to cache_form as pre-prepared form with expire = 0. Then we follow the same way described just before. This will nearly never happen, as we have installed a cron task that runs once a day and checks if the pre-prepared forms are there or not, and if not, the job prepares them.
If it is a post, we recover the cached form with form_get_cache and we process it with drupal_process_form

So basically we have rewritten drupal_build_form in order to have "static pre-cached forms". This increased speed significatively but right now we are trying to achieve F1 speed with this system.


texts: Change dropdown value depending on URL clicked

texts:
Using Drupal 7. From links in an email newsletter, how would it be possible to change the value of a default option value on a webpage? Is there a /?q= that can be used?

email link1 -> my webpage with option 2 selected

email link2 -> my webpage with option 3 selected

by default, webpage dropdown has option 1 selected


texts: Is there a way to auto populate the Alternative text using the image file's Alternative text?

texts:
We have an Article content type that has an image field, field_image. On upload of a new image, the Name and Alternative text is provided.

When we attempt to add the image to the Article node, we have to enter the Alternative text again even though it was provided on uploaded.

Is there a way to auto populate the Alternative text on the Article node using the image file's Alternative text?

Modules used:

Media entity 8.x-1.7
Media Entity Image 8.x-1.3

Steps to reproduce:

Add Image field (field_image) to Article content type.
Create a new Article node.
Click on "Select an Image" for field_image and upload a new image (popup shows up allow you to choose from library or upload).
Provide Alternative Text and any other fields to save the image.
After saving, the popup disappears and you will notice the Alternative text is still blank

On upload

After saving image


texts: Is there a hook or event I can tie into before a page gets cached. I need a hook/event that I can call so that I can run some logic on the page that is about to be cached to tell Drupal if I want a particular page to actually get cached. This is a very specific use case to the website I'm working on.


texts:
I have a local Drupal instance with services. I created an endpoint that has user resource included. I verified that all is well by logging in using the endpoint. I am now stuck at registering new users through the api. I tried the following:

URL: http://localhost/recipes/api/user/register

Method: POST

Content-Type: application/json

Body:
    {
   "name":"user34",
   "pass":"3323",
   "mail":"sample@example.com",
   "status":"1"
}

Result: 22:CSRF validation failed

I know that this error pops out when the token is not passed in the header of the request but how am I supposed to get the token if I am an anonymous user wanting to register?

Kindly mention the steps that I need to follow to have a user register through the REST api

Thanks :)


texts: Custom form, input with ajax autocomplete not working

texts:
I have developed a module with a custom form but I don't know why ajax autocomplete doesn't work. The form works good, but in one of the input field I'd like to have a autocomplete function. The next is part of my code:

src\Form\Mycustomform.php

...
public function buildForm(array $form, FormStateInterface $form_state, $parameter = NULL) {
...
    $form['customer'] = array(
      '#type' => 'textfield',
      '#title' => t('Customer'),
      '#id' => 'inpCustomer',
      '#autocomplete_route_name' => 'mymodule.autocomplete',
    );
....

mymodule.routing.yml

mymodule:
  path: 'mycustompath'
  defaults:
    _form: '\Drupal\mymodule\Form\Mycustomform'
    _title: 'Records'
  requirements:
    _permission: mycustompermission

mymodule.autocomplete:
  path: 'autocomplete'
  defaults:
    _controller: '\Drupal\mymodule\Controller\MyModuleController::autocomplete'
    _format: json
  requirements:
    _permission: 'access content'

\src\Controller\MyModuleController.php

...
class MyModuleController extends ControllerBase {

    public function autocomplete(Request $request)
    {
        $string = $request->query->get('q');
        $matches = array();
        \Drupal:logger('autocomplete')->notice($string);
        $query = \Drupal::entityQuery('node');
        $query->condition('type','customers');
        $query->condition('title', '%'.$string.'%', 'like');
        $query->sort('title');
        $query->range(0,20);
        $entity = $query->execute();
        $nodos = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($entity);
        foreach ($nodos as $row) {
            $matches[] = array('value' => $row->getTitle(), 'label' => $row->getTitle());
        }

        return new JsonResponse($matches);
    }
}

If I see drupal log, I never get a register as expected. But if I see conosole log, I don't see ajax request. How could I find where is the problem? I think there isn't an ajax call when I write some letters on the input field. I don't see the circle on the right of the input that is shown when autocomplete is working.


texts:
I am totally new to Drupal Ajax. In my projects one simple form with submit button only there for insert "yes" value to Database. so it should be done with Drupal Ajax. So When that button submit the value should be store in Db with out page load and after submit display text " successfully selected" instead of button.

So please anyone can help me for this task


texts: Adding extra field on Main menu, similar to Amazon.com

texts: I'm building a new website on Drupal 7 and my client wants a menu that in addition to the menu items he be able to add html content, very similar to Amazon.com menu. Should I create a content type for my menu instead?


texts: Put a wrapper div around every second row in drupal view

texts:
Hi there I am trying to use a views template override to put a wrapper div around every group of two rows. If the last group only has 1 row ( say if there were 5 rows total ) I want to end the wrapper div.

I found some code for this but it's not working I am getting zero output from this I can see my comment tag but that it.

<?php
$group_nr = 1;                  // first group number
$last_row = count($rows) -1;    // last row
$wrapper  = 2;                  // put a wrapper around every 2 rows
?>
<?php foreach ($rows as $id => $row): ?>
<?php if ($id % $wrapper == 0) {print '
'; $i = 0; $group_nr++; } ?>
<?php print $row; ?>
<?php $i++; if ($i == $wrapper || $id == $last_row) print '
'; ?>
<?php endforeach; ?>

Any idea what I am doing wrong

My template is called views-view--homepage-awards--block-2.tpl.php

I want my output to look like this

row1

row2

row3

row4

row5

Any help would be greatly appreciated.


texts: Show comment author e-mail in comment.html.twig

texts: Anonymous users can leave their e-mail when posting a comment but how can I display this e-mail as a plain text value in the comment.html.twig?


texts:
I want code to be executed every n minutes. I know there is a way to run cron in Drupal with crontab but in my case it runs every 3 hours.

What would be the best way to achieve this without using crontab? Can I execute code every time a user opens the first page?


texts: Sort criteria in views: how to add custom one

texts:
I have added a "node title" field.  I want to add this sort criteria to the node: the number of times the node  has been viewed by visitors in a week, descending.
If I want to add a sort criteria with PHP code and a SQL query to insert in Views module, how should I do?

ps:i have overwritten a field. i want to query the database and using the query to Sort Criteria**how to add the custom one


texts: Best way to deal with node data that should only be displayed in views

texts:
Possible Duplicate:
  How to prevent access to Views-only content?

Sometimes I build a content type whose data really only makes sense to display in a View.  An example would be a content type called "Slide" and a View called "Slideshow". I may not want people or search engines to actually go to the node because the slideshow is displaying a series of slides, and by itself, the "Slide" is not very interesting.

So what strategies do site builders usually employee in this situation? Do they style the "Slide" node so that if someone goes there, it looks OK? Do they un-publish the "Slide" so only admins can access it, and then program the view to not filter on only published content?


texts: Tokens causing incorrect text substitutions

texts:
I'm running Drupal 7 on Ubuntu 14.04 server, core and all modules up to date as of today (7th May). We have noticed today that zeros (0) are not displaying correctly in blocks that have a custom token. They are being substituted for the word 'custom'.

For example, "7,500" displays as "7,5customcustom".

I'm not sure how long it has been doing this, as we have only just noticed it today. In blocks without Custom Tokens, the zeros display correctly. This is a relatively recent issue, as it was not a problem a couple of months ago when our site was reviewed by our solicitors.

The source for the content is correct - so it appears to be a display issue. Any ideas?

As an aside, the zeros being replaced need not be in the Custom Token to be replaced (it happens whether they are part of the Custom Token, and when they are just plain text on the page).


texts: How to update block with step links based on AJAXified multipage entity form state?

texts:
Brief

I'm using Entityform with Field group configured as Multipage with AJAX enabled for multipage groups provided by Field Group Ajaxified Multipage. So there are multiple steps and user can access (jump into) these steps through provided Multipage jumplist block.

See some sample images (to give you some visual idea):

Problem

The problem is that form is AJAX (dynamic) and jumplist block is static (which is unaware of form context and links doesn't work) with some basic jQuery code (so it's not reloaded when user goes to next pages).

As result this is what happens:

when field_group multipage is AJAX, the form validation works per step, but jumplist doesn't work (jQuery events are not attached to the links and other steps are not available as it needs to be loaded via AJAX),
when field_group multipage is not AJAX, the jQuery events works, so you can switch between pages, but the server-side validation doesn't work as nothing is submitted on Next button

but I need both to work (server-side validation and jumplist links).

Further info

See also the following related issue.

I'm thinking to do:

jQuery, but I'm not sure how to access the step the user is in,
rendering navigation block (or jumplist it-self) with the AJAX form (dirty and tricky), e.g.

// Implements hook_form_alter().
$block = module_invoke('multipage_jumplist', 'block_view', 'd07d74b8ad268f8c');
$rendered_block = theme('block', $block);
$theme_code = theme('multipage_jumplist', $foo);
$form['navigation'] = array('#markup' => $rendered_block);

not to use AJAX, but I need it for step-by-step server-side validation (FGAM+IFE),
create a session variable and pass to the JS (but the page won't be reloaded), or override jumplist theme hook, e.g.

// hook_form_alter - Get step we're in.
$step = empty($form_state['storage']['field_group_ajaxified_multipage_step']) ? 1 : $form_state['storage']['field_group_ajaxified_multipage_step'];
$curr_step = &$_SESSION[end((arg())) . '-step'];
$curr_step = max($step, $curr_step);
// theme_multipage_jumplist_item - Parse the jumplist
$visited_steps = &$_SESSION[end((arg())) . '-step'];
if ($variables['counter'] <= $visited_steps) {
    // return either clickable item or not.
}

customize/patch the module (where to start),
find some alternative solution

Question

How do I alter/update my multipage jumplist block (unaware of form context) based on the current step user is in having AJAXified form?

By updating I mean either knowing which element is active, or have ability to extend the behaviour and disable further steps (from being clickable) which weren't visited yet.

What's your suggestion? What would be the Drupal-way?


texts: Validation not working on form in Modal using cTools in Drupal 7

texts:
I have a form which I am calling in popup modal using cTools, I added some validation rules in custom JavaScript file but those validations are not working and form is getting submitted, though validation on drupal level is working like suppose if I make the field required in form by adding #required it works fine but adding rule for required in jquery is not working. Can you explain why and provide a solution for this ?

$('#form_ID').validate({
                    //errorElement: 'span',
                    rules:{
                        first_name: {
                            required: true,
                            minlength: 3,
                            maxlength:30
                        },
                        last_name: {
                            required: true,
                            minlength: 3,
                            maxlength:30
                        },
                        select: {
                            required: true
                        },
                    },
                    messages:{
                        first_name: {
                            required: "Please enter a first name",
                            minlength: "Your name must consist of at least 3 characters",
                            maxlength: "Your name must consist of at least 30 characters"
                        },
                        last_name: {
                            required: "Please enter a last name",
                            minlength: "Your last name must consist of at least 3 characters",
                            maxlength: "Your last name must consist of at least 30 characters"
                        },
                        select: {
                            required: "Please confirm you have approval from your authorised account representative to use this account.",
                        },
                    }

                });

These validations are not working on js level.


texts: Error: Unsupported operand types in theme() (line 1088 of /home/mysite/public_html/includes/theme.inc)

texts:
I noticed the error regarding Web Widgets ever since upgrading from PHP 5.3.3 to PHP 7.0.2. Line 1088 is the following:

$variables += $info['variables'];

After originally posting in the module's issue queue, I was told by the maintainer that a theme function with a value instead of an array needs to be called. So I checked the web_widgets.module file, and found three functions that return the theme variable, at least one of which I think might be the source of the problem:

1):

function web_widgets_theme($existing, $type, $theme, $path) {
  $theme = array(
    'web_widgets_embed_code' => array(
      'variables' => array('code' => NULL, 'style' => NULL),
    ),
    'web_widgets_tracking_code' => array(
      'variables' => array('id' => NULL),
    ),
  );
  $style_files = array_keys(web_widgets_get_styles());
  foreach ($style_files as $style) {
    require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
    $definition = call_user_func('web_widgets_style_' . $style);
    if (is_array($definition['theme'])) {
      $theme += $definition['theme'];
    }
  }
  return $theme;
}

2):

function web_widgets_render_embed_code($style, $variables) {
  require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
  // TODO Please change this theme call to use an associative array for the $variables parameter.
  $code = theme('web_widgets_' . $style, $variables);

  // TODO Please change this theme call to use an associative array for the $variables parameter.
  return theme('web_widgets_embed_code', array('code' => $code, 'style' => $style));
}

3):

function web_widgets_render_widget($style, $content, $title, $add_target = TRUE, $scripts = array(), $styles = array()) {
  require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
  if ($add_target === TRUE) {
    $content = _web_widgets_rewrite_anchors($content);
  }
  module_invoke_all('web_widgets_render_widget', $content, $title);

  return theme('web_widgets_' . $style . '_wrapper', array(
    'content' => $content,
    'title' => $title,
    'scripts' => $scripts,
    'styles' => $styles
  ));
}

This is how far I got so far. Does anyone know how to solve this issue, or at least its level of complexity? Any help would be greatly appreciated.


texts: custom function to delete determined content type's nodes never finish

texts:
I am trying to make a custom module which delete all nodes of a content type and then import new nodes of this type from a .txt (maybe I will use feeds import for this).

In the first step of my module, I had found this code to delete nodes:

function nodes_import_delete() {
  // Gather all the pivot content that might have been created while this
  // module was enabled.  Simple selects still use db_query().
  // http://api.drupal.org/api/function/db_query/7
  $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  $result = db_query($sql, array(':type' => 'apunte'));
  $nids = array();
  foreach ($result as $row) {
    $nids[] = $row->nid;
  }

  // Delete all the nodes at once
  // http://api.drupal.org/api/function/node_delete_multiple/7
  node_delete_multiple($nids);
}

My problem is this function never finish when is executed and I don't know why.

apunte is my content type which I want to delete all nodes.


texts: How can I have Devel generate nodes with different terms and not always the same term?

texts: I am using the Devel module to generate content (nodes) as a test. The content type has a field referencing a vocabulary that has terms already added to it. When 1000 nodes are generated, Devel assigns the same term to every node (the first term in the vocabulary). Is it possible to have Devel assign different terms at random to different nodes? How about setting one term as the default value for the field?


texts: Can I cast a generic type reference (EntityInterface) of an object, to a more specific, AccountInterface, if I know the object is a user?

texts:
Here is my code
// implements hook_node_presave
function mymodule_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {

  if ( $entity->getEntityTypeId() === 'user'  ) {

so now I know the $entity is a user, can I then do:
  $user = (AccountInterface)$entity;  // type-casting: a generic type down to a more specific one

so that I have the methods (functions) that the AccountInterface provides specifically for querying the contents of the user object, e.g. getRoles
Is this the correct Drupal convention, to do that PHP type casting?  I'm familiar with it also in C++ and Java.
If it isn't the convention, then how would one be able to invoke method(s) functions that one should expect to be available, on that object?
I suppose I could get another copy of the object using the id of the entity, which has the more specific reference interface but that seems wasteful, if I already have the object in $entity.
Overall, I'm trying to do something with the User object that is available from the hook parameter. I don't want to use current user, because what I want to do is for another user that has been created and modified/updated, so I need to work with the user passed via $entity


texts:
I have View page like example.com/abc and I need to create subdomain abc.example.com that will show this page, but not like abc.example.com/abc.

I need to looks like it's the homepage of this subdomain.

How I can do this? Do I need some additional configuration on hosting or htaccess? What is the best way to go?


texts: How do the variables in .twig files work?

texts:
I am using a theme based off awesome zymphonies theme.
I'm trying to use the site_logo variable from page.html.twig, but it doesn't have access to it, instead I have to use the page.header region, which somehow (I need clarification as to how) calls upon the code in block--system-branding-block.html.twig and there I can use site_logo.
So my question is why site_logo can only be accessed from that twig, and what would I need to do in order to use site_logo, or any other variable in any other twig file?


texts: After using unset($form['author']); for comment module drupal returns errors

texts:
As I would like to allow users print their names with comments I added a new field called comment_name. To not have 2 fileds with name I used the code to unset filed "name" from comment.module

function user_add_node_form_comment_form_alter(&$form, &$form_state) {
unset($form['author']);
return $form;
}

But after adding a comment I receive an error message

Notice: Undefined index: name in function comment_form_validate() (line 2127 in file D:\sites\theme\www\modules\comment\comment.module).
Notice: Undefined index: mail in function comment_form_validate() (line 2140 in file D:\sites\theme\www\modules\comment\comment.module).
Notice: Undefined index: homepage in function comment_form_validate() (line 2143 in file D:\sites\theme\www\modules\comment\comment.module).

I guess it because I unset a form that has to validate if user logged in or not but don't know how to solve it.

P.S. Also I use the Ajax Comments Module


texts:
I am creating a big Drupal theme with lots of node types and lots of custom templates. Each having a very diffent look and feel. This is something I can not get round because the design was signed off before Drupal was decided as a platform. I wish to organise my files into folders.

templates/content_type/node-content_type.tpl.php

So for example

templates/page/node-page.tpl.php
templates/blog/node-blog.tpl.php
templates/node.tpl.php

The problem is drupal only scans for the templates files in the same folder as node.tpl.php.

Is it possible to get Drupal to scan into subfolders? Even if I need to hardcode where to look I don't mind.

Views does something which means it can look in subfolders but I don't know if that is because it defines its own type rather then a core type (node/page).


texts: Installing drupal 8 core (using standard profile). whenever I get exception/error, I get blank page with "The website has encountered an error. Please try again later." (as below image) text and no details/trace about error.


texts:
I'm using Drupal core 8.9.3 and Mime Mail 8.x-1.0-alpha3.
I have installed MimeMail and implemented mymodule_mail hook.
The UI is set to use "Mime Mailer mailer". The UI for Mime Mail is configured to Not 'Link images only', and to use 'Full HTML'.
Emails are sent and display correct html with embedded image tags.
However there is a problem with the image being MIME-encoded and included as a message attachment.
The below simplified email only has a paragraph tag enclosing an image tag with a test src as  src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png".
Below is the raw email.
Please, any suggestions.
Date: Thu, 20 Aug 2020 01:46:23 +0000 (UTC)
Content-Transfer-Encoding: 7bit

This is a multi-part message in MIME format.

--e3e18d39bfaeb05c93e9fe993b85d9033ac7dadb1
Content-Type: multipart/alternative;
 boundary="caf5a2b1e29cb0704a73a98e3c656acf261f57860"
Content-Transfer-Encoding: 7bit

--caf5a2b1e29cb0704a73a98e3c656acf261f57860
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

--caf5a2b1e29cb0704a73a98e3c656acf261f57860
Content-Type: text/html; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://ww=
w.w3.org/TR/html4/loose.dtd">

    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf=
-8">
    <title>Mime Mail message template</title>

&#13;

--caf5a2b1e29cb0704a73a98e3c656acf261f57860--

--e3e18d39bfaeb05c93e9fe993b85d9033ac7dadb1--


texts:
I create a workflow for the content type "Article":

creation -> draft
draft -> expert review
expert review -> head review
head review -> publish

When authors create an article node, and send it for "expert review," they can still view and edit the node but "expert review" cannot view the node.

Is there any bug or trick for Workflow?


texts: How do I get Views content items in "my language" but fall back to "default" if the content isn't translated?

texts:
This is probably very easy but endless searching has proved fruitless - there's lots of UI changes between the D7 and D8 versions of these modules it seems.

What I want to do is create a blog in two languages. The default language is English. Mostly, the author will be translating the articles to Italian. However, I would like to create the blog view such that:

only one translation shows in the list, per node
if viewing the site in italian but there is no translation of a specific list item to italian, the english version shows (fall back to default language)
if he's only written an italian version, show that anyway instead of the non-existent english one

The options in views are similar looking to everywhere else, but in those other places this isn't really an issue. In standard nodes, the fallback kicks in automatically. Any ideas of how to configure this?


texts: Hide dates in the present in .tpl.php files

texts:
I've got a content type (Events) and they have event dates. Some of them have multiple dates, some of them haven't. But I want to hide the dates which are in the past.

Obviously, February 15th and April 18th are already passed. How can I hide them?

When I do var_dump($content) in the tpl, all I got is this:

15 February 2012 - 14:00 to 16:30

So it looks like I can't filter in PHP since it's already converted into HTML. Any idea how I can filter this?

EDIT: screenshot of my date section


texts: Entity reference, display custom field, not the title

texts:
I am using drupal 8.
I have two content types:

ORGANIZATION with the following fields
- Title
- image logo
- much more fields

EVENT
- Title
- Start Date
- End Date
- Reference to the organizations (unlimited)

The event page needs to display the title of the event, start date, end date and all the logos of the organisations (not the titles of the organizations)
How can I do this ?

In the "Manage Display" of the fields in the Event type, in the "Format" there are only 3 options, "Rendered Entity", "Entity ID", "Label". For "rendered entity" there are a few options as "Default", "Full content" and some other. But I cannot see an option to specify only to display the logo.


texts: Why are all Drupal mails going to spam folder wheter it is reset password mail, account activation e-mail etc.?

texts:
All the e-mails from my site are going but they are going to spam folder, whether its the Drupal system generated mails like reset password mail, account activation mail etc.
 How can I prevent that?


texts: Adding template to garland, preprocess page doesn't work

texts:
So I am trying to add an additional page to garland at http://site.com/processfront, this code does not seem to run and or change the template. I know the code is being run however, since i get an error if i purposefully mess up syntax. But, I tried defining some other arbitrary variables and printing them and that didnt work either... What's going on? Thanks

function phptemplate_preprocess_page(&$vars, $hook) {
  $vars['tabs2'] = menu_secondary_local_tasks();

if (arg(0) == 'processfront') {
   $variables['template_file'] = 'page-processfront';
 }


texts: what about multiple files and their archives in sites/default/files/[css] and /[js]?

texts:
/sites/default/files/css & /sites/default/files/js
my drupal sites above folders are filled with numbers of css and js files respectively and also with their archives. What are these meant to? and what they have effect on the performance of my site?

One thing i know when i explore my css in fireug, most of contents are refferd from these and even repeating and over-rided contents also appear.
How i can overcome this problem so no css over-ride?
following is the image of css ove-riden, their actual path is sites/all/theme/themename/css but here these are from sites/default/files/css


texts: sending a daily digest of content (add, edit, delete) actions by email

texts:
I am trying to send a daily digest of all the content entities that have been added, edited or deleted.
I am working on Drupal 8 so most of the good modules that achieve that are unstable and incomplete, what can i do? can someone point me to the right direction ?

a really good example would be in Drupal interface, when opening Reports->Recent log messages then filter them by content. Can i somehow send them by email ? and filtering them by date, so I only sent the recent ones..


texts: How to sell digital goods (redeem codes) using Drupal?

texts:
I'm considering Drupal as a platform for a web project I'm working on.
I'm looking for a way to sell redeem codes using UberCart, Drupal Commerce or some other module.

The client will be able to buy a single code or several codes and receive it/them by email.

Redeem code format : 201504[variable_value],  eg : 201504846, 201504965, 201504347...

Any ideas on how to manage this? Will every code be considered as a product (unique SKU)?

I need to be able to import the codes into the Drupal store. How will I be able to achieve this? I buy the codes in bulk and get them in an Excel spreadsheet.


texts:
How can I  write a query to do the following:

select cid, thread and paragraph_id(I have added this field to comment table) from comment table, and then sort them first based on the paragraph_id and  then based on thread. So for the comments that have the same paragraph_id they will be sorted by thread number.


texts:
On a node add/edit form I have "upload file" and "link to url" form fields. I would like to create tabs for "upload file" and "link to url" for each field.

I would like ajax style tabs that don't require a reload of the page. Is there a solution for that in Drupal or do I need some css magic?


texts:
I have a content type with field_slides and I want to use it on multiple region in the same page. its a slide show using light gallery, at mobile view I want to hide the first div and show it on the second one.

 {{content.slides}}

{{content.slides}}

The issue is the slides works fine on the first div but if i try to open it on the second div it keeps scrolling  to the top ( first div )/reloading the page sometimes. However if I removed the region from the first div it works fine on the second div, I want to have it working on both the divs. Is this possible ?? please help

I also tried this

Its not working either ---

Here is the actual twig template

{% set slider2 = content.content_2_project %}

              {{content.content_1_project}}
              {{content.content_1_punch}}

                  {{content.content_2_body}}
                  {{content.content_2_body_details}}

                    {{content.content_2_project}}

                {{ slider2 }}

i'm using Fullpage.js on the drupal 8 site.


texts: Override contrib Disqus behavior settings

texts:
I want to override a contrib module's library setting that is being attached to page using hook_js_settings_alter(). But, I am unable to change the setting that is being called in js.

Here is the code that is being called in Disqus module Element:

$element['#attached']['library'][] = 'disqus/disqus';
$element['#attached']['drupalSettings']['disqus'] = $disqus;

I want to override settings in $disqus that is being called in Disqus.js

Drupal.behaviors.disqus = {
  attach: function (context, settings) {
    // Load the Disqus comments.
    if (settings.disqus || false) {

I could override this element with hook_element_info_alter, but is there a way to override the above settings.disqus using other hooks.


texts: Insert code in to field or center of content type that already has 1000's of nodes

texts:
So i'm trying to put Google Adsense in to the middle of a node of a few different content types and have tried does this in various ways but to no avail.

The latest method was to put the google adsense in to a block, which works and then use block reference module as a field, this bit works too which in turn shows the google adsense in the exact place I want it, above certain fields and next to the main body field. The problem with this method is that I want it to show on every node already created, which there are thousands of. I have used https://www.drupal.org/project/field_defaults to select the block on that field and to force it to show on all already created nodes, but this last bit doesn't work. I still have to go through the nodes individually and add the block reference.

Another method I tried was to create a field called Google Ad Content and then add the default google adsense code, as above, this doesn't work because I have to preselect the text format to work with the google adsense code and also update all of the nodes and I end up with the same problem as above.

How else can I go about this?


texts: How can I filter out specific words in a node body?

texts:
For example, suppose a user creates a node with body value "Hi everyone. GARBAGE VALUE This is my node." Upon submission, I want to be able to filter out "GARBAGE VALUE" and replace it with nothing (or have a replacement value) so that when the node is displayed, it only displays "Hi everyone. This is my node."

Is there any way to do this? Rules? (Rules is the only module that I have yet to figure out despite trying.)


texts: How to create custom ECK entity class (per bundle)

texts:
With ECK I created Entity type Vehicle, and added 2 bundles, Car and Truck

Goal is to have a class Car so I can use Car::create() and similar entity functions, and also implement my own functions.

As far as I came is creating Vehicle class, and it's working, but I'm struggling with bundles.


texts:
I am trying to test custom views field & filter plugins using PHPUnit, but I keep getting dependency issues. I am curious to know if:

It possible to Unit test View plugins?
Simulate DB interactions.
Is it possible to inject services e.g database, request, response etc via a constructor, setter or property injection?

Thanks in advance.


texts: Title link doesn't change after the content type has been changed

texts:
The title link for a view block doesn't change after the content type has been changed.
Title "Video" links to http://example.com/video.

After changing the title to "Entertainment" and the content type to "Entertainment", the "video" title has changed to "Entertainment" but the link still link to http://example.com/video.


texts: Force View to be displayed only in a specific domain

texts:
I am using the Domain Access, Domain Access Views and Views modules.

I want to create a domain-specific view that will be displayed only in a specific subdomain of the website and if someone tries to access it from a different subdomain, he will be redirected to the proper domain.

So for example when a user navigates to:

http://www.example.com/myViewPath

or

http://customers.example.com/myViewPath

he should be redirected to:

http://blog.example.com/myViewPath.

Is there a way to do that?


texts: I would like to create and display content type in a hidden region. The only reason to hide the region is to prevent moving the location. It is for flash file header banner that will be changed by a user by adding or modifying the content type. If it must be a block, then I suppose it doesn't much matter if the region is visible or not. Any suggestions?


texts: more than one content type in a condition?

texts:
I'm using this as below described in my subtheme (Thanks to @4k4 and @Berdir):

function kanu_preprocess_node(&$variables) {
  if($variables['node']->getType() != 'test') {
    return;
 }
  $field = $variables['node']->field_where_to_publish;

  if (!$field->isEmpty() && $field->entity->label() == 'public') {
     $variables['display_submitted'] = FALSE;
     $variables['content']['comment']['#access'] = FALSE;
  }
}

How to write it for 3 different content type (with same field names)?


texts: User registration profiles - not shown in user detail

texts:
I'm using the multi step registration module to have different steps in my register form. I have multiple Profile2 types for my user registration.

The user registration is shown in different steps, each step is a profile type. This all works fine. I can also edit a user with the wizard. The problem is when I want to see the user details I only see one profile of the user.

I've checked the permissions about profile but they are correct. Also checked manage display but nothing is hidden. What could be the problem of this?

Also tried to alter the function hook_profile2_view_alter

function other_profile2_view_alter($build) {
    dump($build);
}

But the dump shows that only fields of one profile are shown.

UPDATE:

This is the overview of my Profile types (these are all the steps shown in my user registration):

And this is when you click on edit of a profile:

As you can see the step is shown in the user registration.


texts: Is there any alternative of node_save to update database fields in iteration?

texts:
In Drupal 7, we have big product catalog where we need to update price and stock frequently via Cronjobs.

If we update only 5000 prices then also it takes around 20 min.
In each iteration we use node_load() and node_save() functions to update for each product in database.

It seems that these functions are consuming more memory and taking more execution time to just update 1/2 fields in database.
It's drupal's API, so it would be integrated to some other stuff (like node revision) so I doubt that we can simply replace node functions with direct queries.

But I think, this scenario would be common when we manage large product catalog in drupal.

Can anyone suggest better/optimized approach for this scenario where it doesn't break the integrity with drupal platform?


texts:
I'm trying to follow this tutorial here: http://net.tutsplus.com/tutorials/create-a-facebook-recent-activity-drupal-module/

But it doesn't render any output with mymodule_node_view, code below:

<?php
    /**
    * Implements hook_node_view().
    *
    * Returns the renderable view of our nodes (pages or articles).
    * We want to moddify the code so that we add the like button
    * to our pages.
    */
    function fbrecent_node_view($node, $view_mode, $langcode) {
  $node->content['fbrecent_additional_field'] = array(
    '#markup' => theme('fbrecent_add_like_button'),
    '#weight' => 10,
    );
    }

    /**
    * Implements hook_theme().
    *
    * Just to let Drupal know about our theme function.
    */
    function fbrecent_theme()
    {
      return array(
        'fbrecent_add_like_button' => array('variables' => NULL),
      );
    }

    /**
    * Function to add the desired code to our page.
    */
    function theme_fbrecent_add_like_button()
    {
        $output = '123';
        return $output;
    }

I'm not sure what's wrong, I've cleared cache as well. Using some string value for #markup renders the content though. So it's issue with the 2 functions, either fbrecent_theme() or theme_fbrecent_add_like_button()

And is there a debugging option somewhere that would output any kind of information of what's going on in the background? Like if it doesn't have said function/hook, it should output some kind of warning or error for me.


texts: Revert configuration languages overrides

texts:
Suppose you have a Drupal 8 multi site installation, with multi language support, and a custom module used across multiple sites.

This module has a view, with the yml file in:

custom_module/config/install/views.view.custom_view.yml

You also have to maintain some strings translations for this view to multiple languages (the view title among others). So for each language, you have:

custom_module/config/install/language/[langcode]/views.view.custom_view.yml

You install a new site enabling the custom module, and then adding languages to the site, and the configuration languages overrides are loaded properly into config table with collection attribute to language.[langcode].

But… then you update the language file, adding missing strings or editing one of existing. Replicating those translations manually into production environment is not an option, because you have dozens of sites using this module… How can you reload these strings translations in a programmatically way for preparing a hook_update_n in the custom module, or via a drush command?

For updating configurations I'm using config_update module, with the following approach:

$configUpdate = \Drupal::service('config_update.config_update');

// Reload existing config
$configUpdate->revert('view', 'custom_view');

// Import a new config
$configUpdate->import('view', 'new_view');

But for reverting translations of those configurations I haven't found any approach yet. Any idea?

Thanks in advance.


texts: How to solve “This version is not compatible with Drupal 7.x and should be replaced” error?

texts:
Similar to but the solution doesn't work: How to solve "This version is not compatible with Drupal 7.x and should be replaced" error?

I've followed everything I can find but a basic custom theme in sites/all/themes is not working at all. Here is my .info:

name = Custom
description = Custom custom theme built with Stark
package = Core
version = 7.1
core = 7.x

regions[content] = Content
regions[main_nav] = Navigation
regions[sub_nav] = Sub Nav
regions[landing_large] = Front Large Box
regions[landing_ads] = Landing Ads
regions[landing_ad_bottom] = Landing Ad Bottom
regions[landing_books] = Landing Books
regions[home_first] = Home first
regions[home_second] = Home second
regions[home_third] = Home third
regions[search_box] = Search Box
regions[search_ad_box] = Search Ad Box
regions[content_first] = Content First
regions[content_second] = Content Second
regions[content_authors] = Content Third
regions[content_blogs] = Content Fourth
regions[sidebar_right] = Sidebar Right
regions[footer_first] = Footer First
regions[footer_second] = Footer Second
regions[footer_third] = Footer Third
regions[footer_fourth] = Footer Fourth
regions[copyright] = Copyright
regions[shopping_cart] = Shopping Cart

stylesheets[all][] = css/layout.css

I've tried with and without Package, it clearly has defined the version, the core version, the content region...what is it? I copied the .info file from a theme that works perfectly and this is the .info of that other theme verbatim.


texts: Clean URL leads to duplicate URL after migration to another hosting

texts:
I have enabled clean URLs on the site after various article has been published on the site.

But when I migrate from Bluehost VPS to Bluehost Share hosting, the clean URLs is not accessible again. And when I remove ?q= I will see the enable box, and it has lead to duplicate URL on articles on the site.


texts: Is it possible to make a entity reference field translatable and keep content in existing translations?

texts:
In our current project we use entity reference fields widely. There is quite a lot of content that already has translations.

Now we would like to enable translations of some of these entity reference fields.

When I did so I noticed that only the original language version of the nodes keep the contents of the fields - the translations show up with an empty entity reference field.

Did I just stumble into yet another Drupal gotcha? I looked through Drupal 8's issue queue but could not find anything related.


texts: Unable to install themes on new Drupal install

texts:
Note: I'm self hosting Drupal so I have full access to the server -- searching for this error seems to only bring up solutions to shared hosting situations.

I'm running a Drupal multi-site installation and attempting to install a new theme via the GUI. After logging in as admin, I go to Appearance -> Install New Theme -> and upload my tar.gz file. I get the following error:

Unable to create directory 'temporary:'

I've navigated to the File System settings in Drupal and changed around the location of the temp folder, created a new folder, used the entire path to the folder, set 777 permissions on everything, made www-data the owner of every folder imaginable, and nothing is working. I'm absolutely positive the folder I'm specifying as the temp folder exists, because the theme I'm trying to upload is uploaded to said folder.

Yep, I'm actually uploading a file, but Drupal tells me it can't create a directory.

Has anyone encountered this type of error? I'm using Drupal 7.28 on Ubuntu 14.04 with PHP 5.5.9.


texts: How to send a user an email when a content is published by somebody else?

texts:
I want to send an email to a user when the user's earlier unpublished content is published by somebody else (site administrator, moderator, etc).

I tried doing it with Rules but could not figure out how.

Any help?


texts: search_api_solr with accurate radioactivity sorting in views

texts:
We're using Views to display our search_api_solr results. We'd like to be able to show these results by radioactivity (popularity) sort order.

The radioactivity field is one of several fields indexed by Solr so that it can be used by the Solr views for sorting.

The problem is, the radioactivity value that gets indexed by solr only gets updated when the entity gets indexed. The entity only gets indexed when it gets changed (node_update), or when the Solr index is cleared and everything is reindexed again. Having an entities radioactivity energy adjusted by visiting the entity, does not trigger solr to reindex the entity - and probably rightly so.

I've tried adding a relationship in the Search View to node, but that isn't available as a "search index" view type.

Does anyone have any other suggestions for solving this? There doesn't seem to be a radioactivity hook that lets you execute your own code, i.e. update search_api_item table to say its changed.


texts: hook_views_pre_render - how to print field x after each loop

texts:
I have a grouped view that displaces content containing multiple entity references. I have a field that generates multiple times, because of those entity references. I've looked into modifying views-view-group.html.twig with no luck. Now I'm trying to figure out how to use hook_views_pre_render to accomplish this.

(If it comes up... no, using 'Views Field View' didn't work)

I currently have results like this:

Group Title
 - Item one
   -- entity-ref1
   -- Field-x
   -- entity-ref2
   -- Field-x

I want this:

Group Title
 - Item one
  -- entity-ref-item1
  -- entity-ref-item2
  -- Field x

I've already got the hook set up in a module. I'm just trying to figure out how to use it to rearrange fields and output Field x - After the rest of each entry has output. I haven't found anything.

UPDATE: I tried this solution for removing duplicates - BUT.. it's removing the multiple entity references along with the multiple Field X. I just one Field X pared down to one:

    function webinar_rearrange_views_pre_render(\Drupal\views\ViewExecutable $view) {
      if ($view->id() == 'webinars') {
        $filtered_nids = array();

        foreach ($view->result as $key => $row) {
          if (in_array($row->nid, $filtered_nids)) {
            unset($view->result[$key]); // remove the duplicate
          } else {
            $filtered_nids[] = $row->nid;
          }
        }
      }
    }


texts:
I'm looking to add a the social share block only on the confirmation page. Right now it shows up everywhere. Is it possible to control where it goes?

Here's the path to a completed webform.
node/1015/done?sid=1516

For Show block on specific pages I added
node/*/done


texts: In Drupal 8 can a developer inject Full HTML Pages?

texts:
I have done a lot of work in WordPress but want to develop a new site in Drupal 8. I have two specific questions before I start on my site.

Is it possible to inject full HTML pages via PHP into a Drupal 8 environment? I have full HTML content being served from an API for SEO purposes.

If the answer to #1 is NO:

Is it possible to change header and footer based on specific paths? So everything at /articles will get a certain header or footer? In this case I would want to pass an incomplete  tag and have the API call close the head tag and provide the body.


texts: How can I edit the 'Title' field label of a Node content type within a module?

texts:
I'd like to do this in Drupal 8:

I need to change the label of the Title field on a custom content type  without using admin panels.

I know this is possible via the admin menu, but I feel like I should be able to have the module fully set up when it is installed.  Is there a flag in the content type's configuration file that I can add to override the default value?

Here's my node.type.employee.yml file

langcode: en
status: true
dependencies: {  }
name: 'Employee'
type: employee
description: ''
help: ''
new_revision: false
preview_mode: 1
display_submitted: true
third_party_settings: {  }


texts: Is it possible to filter by taxonomy field?

texts:
Is it possible to filter by taxonomy field in a view, using Drupal 7?

I will try to explain the problem with a silly example: let's say I have a list of countries that are a taxonomy term and each country has a field "Language".

I also have a list of items each linked to a specific country.

I would like to be able to filter by language, getting only those items that have a country where e.g Spanish is spoken.


texts: How to get instance of Module / Plugin / Widget of Vote Object in THEME_preprocess_node?

texts:
My drupal site is using the Fivestar Module or from the Vote Up Down Module.
Multiple of my content types are using various implementations of these as fields (specifically comments and my primary articles. Users can up/downvote comments and articles, and also give them ratings).
In my theme, I want to be able to access things like the vote count, and if the current user has voted, and ideally even the vote and reset links for custom display and front end functionality.
The default way how things are displayed doesn't work for my purposes, and creating specific views/blocks for each little snippet on my page, or manually overriding each template seems too cumbersome, and not flexible enough.
I'd much rather get all the vote info that I need in an array and pass it to my template, to be then displayed for full nodes, teasers, and comments.
How can I make use of the pre-formatted data that the modules are fetching and compiling from the database?
I see for example that abstract class VoteUpDownWidgetBase extends PluginBase implements VoteUpDownWidgetInterface has a method public function build($entity) which does exactly what I need to do. It gets all of the data about the vote field, and formats it for display in a template.
I don't see this equivalent from the Fivestar Module yet, but I'm sure I'll find something useful...
Either way: How can I access this method? What class do I have to get an instance of?


texts: Using different .inc files with same function names in .module file

texts:
In our project, we have this module meant strictly for our custom API endpoints for our mobile applications to use. Currently, this is handled in a single .module file like so:

my_project_mobile_api.module

<?php

function my_project_mobile_api_menu() {
  return array(
    'api/v1/user/register' => array(
      'page callback' => 'account_register',
      'access callback' => 'user_is_logged_in'
      'type' => MENU_CALLBACK
    ),
    ...
  );
}

function account_register() {
  ... logic to create an account
}

Up until now, this has worked great for us, but now we need to add a V2 of the API. My idea was to extract all of the page callback functions (like account_register) into their own .inc file. This would look like this:

my_project_mobile_api.module

function my_project_mobile_api_menu() {
  return array(
    'api/v1/user/register' => array(
      'page callback' => 'account_register',
      'access callback' => 'user_is_logged_in'
      'type' => MENU_CALLBACK
    ),
    'api/v2/user/register' => array(
      'page callback' => 'account_register',
      'access callback' => 'user_is_logged_in'
      'type' => MENU_CALLBACK
    ),
    ...
  );
}

my_project_mobile_api.v1.inc

function account_register() {
  ... logic to create an account
}

my_project_mobile_api.v2.inc

function account_register() {
  ... logic to create an account (this logic differs from that of V1)
}

How can I make sure that my .module uses the right account_register function from the correct .inc file? Is there a way to specify the file in  the api/v1/user/register array?


texts: Query and sort by field on entity referenced object

texts:
I have a custom content type that has an entity reference field, that refers to an existing node from a different content type.

I'm performing the query like so

$query = \Drupal::entityQuery('node')
->condition('status', NODE_PUBLISHED)
->condition('type', 'issue');

$nids = $query->execute();

Each of these issue nodes have a field_publication field that refers to a publication node. Each of these publication nodes have a field_permission_category that I'm grabbing like so.

foreach ($nids as $nid) {
   $node = NODE::load($nid);
   $pub = $node->field_publication->entity;
   $pub_permission = $pub->field_permission_category->value;
}

But I want to be able to order the results of the initial query by the value of field_permission_category from the referenced field, but I'm not sure how to go about that, and I'm not even sure that's possible. Basically I want to be able to do

$query = \Drupal::entityQuery('node')
->condition('status', NODE_PUBLISHED)
->condition('type', 'issue')
->sort('field_publication->entity->field_permission_category->value', DESC);

Can you sort a query by a field inside a referenced node?


texts:
For examples purposes. Say I created a content type called ContentX with a image field and term reference field(Tag). I created 4 node(pages) of ContentX. All 4 nodes of ContentX have 1 Image to each node. Two of these nodes of ContentX have a Tag called TagA.  Two of these nodes of ContentX have a Tag called TagB.

I then create a view block stating that I want to view content from ContentX. In the view fields I make sure the images field is there. All 4 images of ContentX show.

THE ISSUE:
Say I want to show a single image from the 2 nodes with TagA. I go to filters,Content:TagA, check One Of: and bring up my tag which is TagA. HOWEVER instead of showing what I believe to be "One Of TagA", it shows both images of both nodes with TagA Tag.

THE OUTCOME I AM TRYING TO GET:
I am trying to get my View to show one image from 2 ContentX nodes with a Tag called TagA and one image from 2 ContentX  nodes with a Tag called TagB.

Any help?


texts: When I try to browse to a site I get the localhost default page (WampServer)

texts:
I use WampServer, and just installed a theme drupal (Jollyany) on localhost, but when I click to explore the site, this sends me to localhost default page:

I try to see what happens when i get on the hosting. ... get me the following error:

Please help


texts:
I'm having a bit of an issue here and I'm hoping for some professional advice.
Here is my situation:

That's my homepage. In the upper part, there is an image slideshow (no issues there), but underneath are 3 textblocks. The text inside those blocks is quite static but the end-user has te be able to change the content. The tricky part is it can't be blocks or panels. So the one thing I can think of is make a content type for those blocks and use a view filter to show those 3 blocks. But even then, I'm not quite sure on how to do this...

Is there anyone here who can advice me about this issue? Or alternatives on how to tackle this?


texts: Returning a custom command via AjaxResponse

texts: I have a method that is invoked by AJAX call, and it returns an AjaxResponse. It redirects the user with RedirectCommand, added to the response. However, I would like to change it to a conditional redirect. Is this possible with RedirectCommand, or any other way that uses the CommandInterface, preferably in a way that does not require implementing CommandInterface in a new class?


texts: How to use Views to make slideshow of the content created using block type

texts:
To Explain further:

Please I have created a block content type directly from block, say Item_1 using ADD BLOCK then published. I did the same 3twice (item_2,item_3) each carries its contents(body). all published.
Now I want to use views to view this block type via slideshow method. Could this be possible?

All I saw in the filter list of views 3 version are all nodes, content types none points to this.
Please help.


texts: Commerce: save quantity button removing products

texts:
I've come across a frustrating issue after adding a cart view block on my page in the form of a "sidebar". When trying to update a quantity or just clicking the "save" button (at bottom of the view) itself will remove the first line item added to the cart. Finally, a message shows on the next page saying: "line item removed."

I have disabled all non essential and potentially problematic modules. There is no custom Javascript / AJAX written for this button. I've checked the error logs and there is nothing wrong there.

Oddly enough, the feature works fine on our live site using a different theme. I have exported the views and ensured they are both exactly the same.

Does anyone have a clue what might be causing this? Or, any debugging steps I could try out?

Note: I'm on Commerce Kickstart 2.x-2.19


texts:
Ok, I'm on D7 and using the default Bartik theme. I set comments for content type Article to be 10 per page, threaded. I published a test Article and started commenting to test the paging, and when I surpass the set limit of 10 per page, the article only displays the first 10 comments and I don't see a "more" or a "next page" or anything linking to the second page of comments.

I did not touch any PHP or CSS.


texts:
I want to disable the preview and delete buttons on node edit form.I have used the following code.But it is not working. where am i wrong with this?

function mymodule_form_alter(&$form, $form_state, $form_id) {
// Check for a particular content type's node form.
  if ($form_id == 'node-gallery-item-node-form') {
    drupal_set_message("Formid");

    unset ($form['edit-preview']);
    unset ($form['edit-delete']);

  }
}


texts: What tables should or could be migrated to InnoDB, and which should remain MyISAM?

texts:
As per title: Is there a quick list of candidates for tables to migrate to InnoDB? And what should remain MyISAM.

Some additional information

The site has a fairly heavy read-load, but inserts approximately 10 nodes per hour, with tags and such.
We make heavy use of CCK (a huge amount of normalised tables in the form of content_field%).
We also use Views for about all our blocks and pages; but many of those are candidate for replacement with custom modules (as to reduce database-queries and the heaviness of those queries).
Users are all anonymous; with the exception of a few logged in editors and webmasters.


texts:
I need some help with my code. I am creating blocks dynamically using the plugin derivatives. I store some form data in a database table, then I display it in each block separately, depending on it's derivative id. My issue is: while, I do obtain all the individual blocks on a full clear cache, in the "Place Block" section, it's not there when I submit the form, basically, I would like the form submit function to trigger the derivative creation and it's discovery. Any suggestions appreciated.

Here's my Plugin Derivative code:

<?php

namespace Drupal\simpleads\Plugin\Derivative;

use Drupal\Component\Plugin\Derivative\DeriverBase;

class SimpleAdsBlock extends DeriverBase
{
    public function getDerivativeDefinitions($base_plugin_definition)
    {
        $query = \Drupal::database()
            ->select('simpleads_blocks', 'sb')
            ->fields('sb');
        $results = $query->execute()->fetchAll();

    foreach ($results as $result) {
        $this->derivatives[$result->bid] = $base_plugin_definition;
        $this->derivatives[$result->bid]['admin_label'] = $result->name;
    }

    return $this->derivatives;
    }
}


texts: How to pre-populate paragraphs when creating a page

texts:
I have tried for some time to find out a way to populate a new page with a few paragraphs to save time on most of the pages (but which might change position or even get dropped for some pages) but so far haven't found a way to do.

I think I have found out how to do the paragraph adding part, but what I am missing is how to fire the code when a new node of relevant content type is created.

I have tried hook THEME_node_create and THEME_node_insert, but they seem not to be fired when a new node is requested. I read that not all hooks are implemented for a theme but how then to achieve this functionality?

I probably (as most of the times) am missing something trivial, but please, help me find the light.

wbr

hank


texts:
in the upcoming weeks my client want me change some node reference options on his page.

I got 2 content types, press release and press office.
When they create a new press release, they are able to reference to a press office via the "References" Module.

Now they want me to remove some of the press offices and add some new. Thats not the problem,  when I remove the old press offices the old nodes lose their references as well. But they want  the old nodes keep their references, which sounds logical to me, but I've no idea how to do that.

Greetings from germany

sg


texts:
I want to initialize a block of an imported table of data first. Then I want to show the result on a the same block with a different class.
I created 3 exposed filter and it shows me the results.
I just want to hide them using CSS.
Any idea?


texts:
I wanted to add columns to my module schema, I added an update hook hook_update_6031
however when I go to the update.php script my module isn't listed at all, not even as "no updates". Do I have to provide some hook to have my module be listed? I can't seem to find any documentation on how to write updates other than the function documentation for hook_update or looking at some other module code.


texts: How do I load CSS files to a custom theme?

texts:
I understand this question has been asked many times. However, I still can't figure out why the CSS files of my custom Drupal 8 theme are not loading.

Edited (more info): The CSS files are not being defined at all (they do not show up in the HTML).

Here is my test.info.yml file:

name: "test"
type: theme
description: "Theme by ..."
package: custom
core: 8.x

libraries:
  - test/global-styling
  - test/global-scripts

regions:
  headline: Headline
  header: Header
  content_special: 'Content special'
  content: Content
  sidebar: Sidebar
  footer: Footer

And here is my test.libraries.yml file

global-styling:
  version: 1.0
  css:
    theme:
      css/bootstrap-4.0.0.css: {}
      css/content.css: {}
      css/footer.css: {}
      css/header.css: {}
      css/IE.css: {}
      css/lista.css: {}
      css/navigation.css: {}
      css/style.css: {}
      css/taulukko.css: {}

global-scripts:
  version: 1.0
  js:
    js/scripts.js: {}
  dependencies:
    - core/jquery

Note: The CSS files are not being defined at all (they do not show up in the HTML). So the console is not showing any errors about this issue. The css files are accessible if you manually type the path in the browser window.


texts: Keep less files of Bootstrap in productions site after compiling?

texts:
i'm new to Bootstrap, Drupal and Subthemeing so maybe this question is a bit noob. ;-)
I did a Subtheme for Bootstrap 3-Base-Theme with the local bootstrap-files etc. Makes completely sense for developing. But when i'm finished with editing and compiled my styles.css it doesn't make sense to upload also the less-files to my webserver as they are no longer needed, are they? (I just keep them local for developement)

I'm not so sure about the js files, those are still referenced at the info-file.
But i keep thinking that one could drop the less-folder - do you agree?


texts: How to update the search title and page title depending on facet options

texts:
I am using Search Api Views module to list some publications. User can filter them using facets. For example he can look for publications only in Kenya.

I want to update the title of my page (view) depending on this user selection.

Here is a screenshot of my application:

I tried to use Facet API Bonus module, unfortunately I cannot figure out how to use it, I looked everywhere, but cannot find where the configuration interface is located..


texts: How to search for content from the Content Management admin view?

texts:
This feels like such a dumb question to ask, but I can't find a way to search for my content on the Content Management view in the Administration area!

Could somebody point me in the right direction, please?


texts:
How to theme product variation.

I'm trying to find a tpl file but I cannot figure it out.

Basicaly, I would like to override the Size Field. I would like to add a link beside the size field.

Thanks a lot


texts: Can I get a upload progress bar when submitting the form with "submit"?

texts:
In D7, I've got some forms that are responsible for uploading potentially large video files via managed_form fields.  My server is properly set up for showing uploadprogress (or seems to be, according to phpinfo and Drupal's status report), but when I submit the form via the Submit button, I get no progress bar.  Is this just "how it works"?

It's probably worth noting that I've hidden the "Upload" button after a long series of usability problems with my site's users, so that may be a blindingly obvious factor in my problem.  But I'm still interested in getting some sort of upload indication in response to the Submit button; I'm not averse to bashing some stuff into the page via a jQuery .submit() handler or whatever if that's what it takes.  Is there a way for me to have my cake and eat it too?  Thanks!


texts: Show 'log in' in user menu when not logged in

texts:
I'm asking myself, where is the code that hides "My account" & "Log out" in the user menu? Just curious, to learn from that code. Any way to know where to search if you want to know something like this?

I added a "Log in" link to this menu, and I want to hide this when nobody is logged in.


texts: How can I import the configuration on a different site?

texts:
I have this error when I try to import the config of an another site:

  The staged configuration cannot be imported, because it originates
  from a different site than this site. You can only synchronize
  configuration between cloned instances of this site.

I have 10 customers, and I need to sync my site configuration with 10 different websites.
The site UUID is a problem for sharing a configuration with a different website. Is there a solution?


texts: how to obtain fivestar field value in rules?

texts:
I'm trying to a grab a value of a fivestar field within rules and having no luck.

Basically I'm getting users to fill a feedback form and if the fivestar field value is less than 3 Stars then I want the rule to fire but no luck.

Can someone help me figure out to what's going wrong.

Thanks


texts: Copying a site to a multi-site installation

texts:
On Server A (debian) drupal was installed by the package manager. So basically the codebase is at: /usr/share/drupal7 with /usr/share/drupal7/sites symlinking to /etc/drupal/7/sites.

Server B has basically the same setup (ubuntu).

The multi-site feature is configured like that: At /etc/drupal/7 we have a apache.conf:

Alias /site1 /usr/share/drupal7
Alias /site2 /usr/share/drupal7

<Directory /usr/share/drupal7/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all
</Directory>

I copied the Site from A to B. In A it was installed at /sites/default so I copied it to /sites/default at B. The index page (www.foo.com/drupal7) is redirected to /sites/default. So basically it works.

But if I go to e.g. www.foo.com/drupal7/members I get:
404: The requested URL /usr/share/drupal7/index.php was not found on this server.

Also: If I want a multisite like www.foo.com/site1 I create it at /sites/foo.com.site1

Question 1: How can I confiure it so it works on / rather than on /drupal7? So basically I'd like to use this site "normal" on /sites/default but another site at /sites/site1.

Question 2: How can I fix the 404 error?


texts:
If I turn on aggregate css in my performance config and then load my site in IE7, the browser crashes.   Any ideas why that might be?

Thanks,
Paul


texts: How do I programmatically add a new search page to the search page list?

texts: I have been able to successfully create a search plugin for a custom module, which allows users to search for my custom entity by name. After creating this file, I have to enable it by visiting /admin/config/search/pages selecting my search type from the dropdown, and add it after specifying the target path. What is needed to do this within the module? I imagine I would have to create a route somewhere, and then associate this route with the search page list. Any advice on how to do it?


texts: theming nodes as forms - any advantage using drupal_render?

texts:
I need to theme a node content type as a form. For example, the node has fields:

field_body = a question, e.g. "What is your favourite color?"
field_answers = field collection ------------------> these will become radio buttons
    field_content = an answer, e.g. "Blue"
    field_internal = internal value for the radio button
    field_points = how many points for this answer ---------> this will become an html attribute
    field_additional = "some additional info about this answer ---------> this will become an html attribute

and so on, each question has 3 answers to choose. This is a questionnaire, the editor adds questionnaires dynamically. I don't want Webform module in this case.

So far I've written a mymodule_theme() function (in a custom module) for the whole node with answers, and themed it as a form using raw html output, something like this:

$output = '<form>';
... loop
$output .= '<input type="radio" name="myquestion" value="' . $field_internal_value . '"> . $field_content_value .'<br>'
...

But Drupal has form API. I could as well build a $form render array in mymodule_theme(), instead of raw html and then use:

$output = drupal_render($form)

The question:

in the above example, is there any real advantage of building a form array and rendering it using drupal_render, instead of building the output from raw html as shown? For example, advantage with using ajax later, or submitting, or validating "the Drupal way" etc. (I think not because form API applies only to static forms which are defined in a module, but I'm not sure).


texts: How can I create a hidden character field in D7 for a text field that hides the user input like the password field does? For example a field called "social security number" should not display the users input in plain text, but instead hide the input. Is there a module that can do this? Or how would that be realized?


texts: Enabling a custom module after uninstalling it

texts:
I have simple question concerning enabling a custom module after having disinstalled it.
The module provides a simple creation of a new content type based on node content.
It implements a hook_install() function that first time i enabled the module worked perfectly. For debugging reasons i had to disable and unistall the module, then when i tried to enable again the module the system checks it as enabled but the new content type that is the result of the hook_install() function does not appear anymore.

It seems to me that when i try to re-activate the module the installation script doesn't work anymore, and this although i cleared the cache after unistallind the module the first time.

Any ideas?

Here's the install code:

function bachecanews_install() {
  $t = get_t();
  $node_bachecanews = array(
    'type' => 'node_bachecanews',
    'name' => $t('Bacheca News'),
    'base' => 'node_content',
    'description' => $t('Usa Bacheca News per inserire le notizio sul sito.'),
    'body_label' => $t('Contenuto della News')
  );
  $content_type = node_type_set_defaults($node_bachecanews);
  node_add_body_field($content_type);
  node_add_date_field($content_type);
  $status = node_type_save($content_type);
  $t_args = array('%name' => $content_type->name);
  if ($status == SAVED_UPDATED) { // in caso di modifica
    drupal_set_message($t('Il nuovo tipo di contenuto %name è stato modificato.', $t_args));
  }
  elseif ($status == SAVED_NEW) { // in caso di creazione
    drupal_set_message($t('Il nuovo tipo di contenuto %name è stato creato.', $t_args));
    watchdog('node', 'Creato il nuovo tipo di contenuto %name.', $t_args, WATCHDOG_NOTICE, l($t('view'), 'admin/structure/types'));
  }
}

function bachecanews_uninstall() {
  $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  $result = db_query($sql, array(':type' => 'node_bachecanews'));
  $nids = array();
  foreach ($result as $row) {
    $nids[] = $row->nid;
  }
  node_delete_multiple($nids);
  node_type_delete('node_bachecanews');
}


texts: How to define a menu with and without url arguments in hook_menu?

texts:
$items['jobs/%'] = array(
    'page callback' => 'custom_changes_jobs_interface_create_update',
    'access callback' => TRUE,
    'page arguments' => array(1),
  );

I need to use jobs for POST request and jobs/% for put and delete request where the argument would be string but if its not passed I want to make sure it works.


texts: How to create a rule to assign roles to users based on some checkbox items in their profile?

texts:
I am pretty new to Drupal. I am using Profile2 so that the user can select there own user role. So say I have a profile page with some checkbox items like

Automotive
Computer
Garden
etc

How would I add a condition or data comparison in Rules to say, If Automotive is selected/checked, set user role to that role? I also need to be able to select multiple checkboxes to get multiple roles.

Any suggestions?


texts:
I've searched around but found no satisfying answer yet. I have all modules in sites/all/modules, so no site specific modules are present. I'm working on a VM.

First problem - creating a dump file fails:

drush @sites sql-dump --result-file

Second problem - updating the modules:

drush @sites update targets all sites, which is nice. But the modules are in all/modules, individual sites do not have any modules

Side question: Is there a way to update only the core?


texts: How to change dropdown field function to buttons in privatemsg module

texts:
I am using private message module.

In that there is a option to mark the messages as read and unread using drop down.

Here it looks like : http://drupal.org/node/709180

Instead of that i need to place two buttons called "Mark as Read" and "Mark as Unread" and needs to perform the same action.

How can i do it?

Any help will be grateful.

Thanks in adavnce...


texts: How do I connect Netbeans IDE to AWS Bitnami installation?

texts:
I'm hosting a Drupal 8 installation on AWS using the recommended Bitnami image. I'd like to be able to edit some of the files remotely from my computer using the NetBeans IDE. I've successfully created a NetBeans project and I'm connected remotely to the installation at /opt/bitnami/drupal. However, the project doesn't show key directories there, like /modules, /sites, /profiles or /themes. I can't edit the associated files.
Those directories are all owned by root with permissions 0777.
Has anyone run into this and solved it?


texts:
Note: as a neophyte user, I'm not allowed multiple links or images. It has been suggested that I edit my original content in order to add updates. Also it's been suggested to edit the hyperlinks so they're not quite right. Hopefully you can sort out what's going on.

I've been following this post by Kristin Brinner "Drupal Tutorial: Use Views to Create an Alphabetical List of Taxonomy Terms" (at h ttp://getlevelten.com/blog/kristin-brinner/drupal-tutorial-use-views-create-alphabetical-list-taxonomy-terms) but my sample does not produce the results illustrated and by now I'm very confused.

Part 1: said to create new view showing taxonomy terms, display in grid format and create menu link. Done.

Part 2: grouped terms alphabetically (add Taxonomy term: Name, label it "Grouping", exclude from display, rewrite to max length = 1 and uncheck 'trim on word boundary' and 'add ellipsis'). Under Grid-Settings use "Grouping" apply to all displays. My view looks like the sample. Done.

Part 3, Create a Views page for each letter of the alphabet: said to add a Contextual Filter: Taxonomy term: Name. When the filter value is NOT in the url, display all results for specified field. Under More, click Glossary mode, character limit = 1. Note that I now have a Taxonomy term: Name in the Contextual Filter section. I don't know how to test these results.

Part 4, Create A-Z list (create a block that will display the list of first letters in a cute list above the grouping grids) says to add a new Contextual Filter for this block (override). When the filter value is not available, 'display a summary', sort by alphabetical, unformatted, display record count and display items inline. This isn't working as predicted, here is what the tutorial says should be the result: Image 1 in the diagram (h ttp://imgur.com/l9TbLyv). My content continues to look the same as it did previously in the exercise, i.e. like this: Image 2 in the diagram. However when I put "S" into the Preview with contextual filters, I get: Image 3 in the diagram. I was asked for screenshots, so without contextual filters is h ttp://imgur.com/zXCnsvA and with "s" in contextual filters is h ttp://imgur.com/7DF6UUD .

When I created the new contextual filter in Part 4, I got a copy of what was in the Page, so I have two contextual filters, both with Taxonomy term: Name. If I delete the first contextual filter from the block, then my preview shows the same information as Image 1 in the diagram. I think I'm missing something &/or the blog post is unclear. Should I have started "this block override" with 0 contextual filters? I.e. Should I have started by deleting elements from the page which were copied into the block?

Part 5 instructs to "Add the alphabetical list on our page with the grouped terms and Go back to our Page display".

I've got the view working correctly now. The thing which stumped me was that adding a block created an entire copy of the original page which (philosophically) I don't understand. When there's a page and a block override which give instructions about the view, how does drupal know which instructions to pay attention to?

Thanks to all the folks who have helped.


texts: Using views to display content comparing users id

texts:
First of all, sorry for my bad english.

I'm using Drupal 7

Here is my problem :

I have a views in wich I would like to display a list of custom content type only for the users that I selected with a custom field "entity ID" in this custom content type.
This users share the same role, but they can't see the node of others users (of the same role or another role as well).

I taught the simplest method would be to add some PHP code thanks to the PHP views module, but if you have a better solution I'll love to hear that.

So this is what I made so far:

I added a global PHP in the filters criteria section of the view with this code:

global $user;
$current_user = $user->uid;
$destiny_user = $data->field_field_uttilisateur[0][raw][entity]->uid;

if ($current_user == $destiny_user) {
   return false;
} else {
   return true;
}

Basicaly I'm comparing the current user ID with the ID I filled in the content type.
If this "function" returns true, then the current row is not displayed.

I don't have to worry to know if the user is authentified because I already do that in Page settings (Access)

But it seems like $destiny_user is always empty. I don't get it because when I add an global php field in the fields section all seems ok (I can see the ID of the user I whant to display the row)

I'm using this method $data->field_field_uttilisateur[0][raw][entity]->uid; because the $rows->field_uttilisateur; is not working. (It display the nid Oo)
After some research I found this solution that seems to work... at least more than the other one.

I'm having a really bad time with this, do you have some ideas how I can get this to work?

Thank you in advance !


texts: How to implement User registration settings email in my registration form

texts: I have a custom registration field that i have in my drupal 6 site.Once a user has been registered a mail will be send to the corresponding user with his or her account credentials.I have used drupal_mail function for this purpose.Is there any means by which i could create such a mail through the back-end. I have seen User e-mail settings.Is it possible to implement this mail function through the back-end rather than programatically. Is yes i would be really curious to look up on that.Hope someone might help me with this..


texts: How do I programmatically insert the entity ID?

texts:
I have added extra fields on the drupal 7 user registration form and created a module with a hook_form_alter function so that i can alter one field in the registration form.
in the same file i also added the hook_form_submit function to handle the submission of that input box.

function user_registration_form_alter(&$form, &$form_state, $form_id){
if ($form_id == 'user_register_form'){

    $form['field_first_name'] = array(
        '#type' => 'textfield',
        '#title' => t('First Name'),
        '#description' => t('Enter your first name.'),
        '#maxlength' => 255,
        '#required' => TRUE,
        );

}

if (isset($form['actions']['submit'])) {
        $form['actions']['submit']['#submit'][] = 'user_registration_form_submit';
       }
}

function user_registration_form_submit(&$form, &$form_state)
    {
        $fe_id = db_insert('field_revision_field_first_name')
        ->fields(array(
            'field_first_name_value' => $form_state['values']['field_first_name'],
            ))->execute();
        drupal_set_message(t('your form entry has been added'));
    }

When i click on the submit button i get the following error message

  PDOException: SQLSTATE[HY000]: General error: 1364 Field 'entity_id' doesn't have a default value: INSERT INTO {field_revision_field_first_name} (field_first_name_value) VALUES (:db_insert_placeholder_0); Array ( [:db_insert_placeholder_0] => john ) in user_registration_form_submit() (line 38 of /var/www/html/lite/sites/all/modules/user_regestration/user_registration.module)

I noticed the error is generated because the"entity_id doesn't have a default value" when the insert query is executed.
My question is how do i include the entity_id default value.


texts: Should I always save ContentEntityType after updating a value?

texts:
I have bunch of ContentEntityTypes made programatically.
What weirds me out is ::save() method of ContentEntityType.

In the documentation about ::save() method is information that reads:

  When saving existing entities, the entity is assumed to be complete, partial updates of entities are not supported

For example, if I update some value with

<?php $contentEntityType->set('field', $value); ?>

Is it partial update? Do I need to do <?php $contentEntityType->save(); ?>?


texts:
I' switching core search to SOLR. The core search module still needs to be enabled for SOLR to work. How to I remove the (rather large) core search index?

The "search settings / clear index" option says that it won't clear the index and just update new items instead.

I came across search_reindex(). Do I just run that function?


texts: How can I add a CC field to webform email send?

texts:
Does anyone have a solution to adding a CC field to the /node/[nid]/webform/emails/xxx interface?

I have a client that wants to use a decently complex conditional email send solution in Drupal 7 webform, where based on various select lists, it will send an email to two places.

"Real_Person@domain.com"
"Ticket_System@domain.com"

Allowing a real person to be notified and respond via REPLY-ALL to the email, and having the ticket system be updated with the communication in real time.

The ticket system can't handle getting a reply-to with both addresses in the single "TO:" line.

to: Real_Person@domain.com,Ticket_System@domain.com breaks the system.

Has anyone solved this? built a module?  Have guidance on how to solve?

Thank you!


texts: How render first node in views result in different view mode?

texts:
Currently, I handle it by using context. before calling views_embed_view, I set a variable in context and in node.tpl.php at first result I unset this variable...

is there any better way to handle it?


texts: How to programatically hide node field on viewing?

texts:
Using Drupal 9,
How do I hide a node field when viewing it?
Let's say I have field info. I would like to conditionally not display the label or the value.
I assume I use hook_node_view_alter but I'm not familiar with how to manipulate the build render array.
Thanks!


texts: call_user_func() and external functions problem

texts:
I'm trying to create some logic in order to have my code better organized, so I am creating a module and trying to separate functions in different files according to it's content type.

For example, I have a module called my_module and I'm creating two content_types content_type1 and content_type2

So I created this structure:

my_module.install
my_module.module
my_module.content_type1.inc
my_module.content_type2.inc

This logic inside install:

function my_module_install() {
  // During installation, the t() function is unavailable, so we use get_t()
  // to store the name of the translation function.
  $t = get_t();

  //List of objects to be created
  $nodes = array('content_type1','content_type2');

  //Create all the content-types from the array
  foreach ($nodes as &$node_name) {
    error_log('Create: '.$node_name, 0);
    call_user_func('_'.$node_name.'_create_node',$node_name);
  }

  unset($node_name);
}

And this logic inside each file ( content_types )

function _content_type1_create_node($node_name='type1') {}

function _content_type2_create_node($node_name='type2') {}

Since I added this lines to the my_module.info:

files[] = my_module.content_type1.inc
files[] = my_module.content_type2.inc

I was expecting to have all the logic working as it should but

//content_type1_create_node()
call_user_func('_' . $node_name . '_create_node', $node_name);

It cannot find the callback and I think it's because the callback.

Am I over engineering, or doing it wrong?


texts: Pass the id of one node by url for new node

texts:
I have 2 content types, person and date. Date have a relation with person, in one node of person, you can see the dates of that person.

I want add a link in the nodes of person for add a date for that person (this is easy), i need pass the id of the person node automatically to the new node of date.

I don't know how to do this, anyone can help me?

Thanks.

EDIT:

Will try to explain it better:

I use node reference module for create the relation between the two content types. When i add a node of date, all fields are in blanc, if i add one date node through node of person, the id of that node, will add automatically to the new date node in the field that relation the two content types.


texts: Add a views with fields of nodes added from admin in the user profile

texts:
I describe my scenario:

the users in their profiles must display a view (views module) with a list of fields that the admin adds each time;

I assume that the admin must add this fields from a specific content type and display this fields with a views.

My question is: how I can associate the fields of this content type to an user and how I can display in the view only the fields of the nodes that the admin have associated to the user that are displaying the view?

Any help is appreciated. Also change my approach if need.

Thank you in advance.

EDIT

Solve

I solve the issue:

Created a new content type;
Added a user reference field to the new content type;
Created a view that displays only this content;
Added a filter in the view to reduce it to only nodes that reference the currently viewing user;
Created a block in the view and place it to be only displayed on the user profile page;


texts: Best way to keep local and remote sites synchronized?

texts: I run the same drupal site on a local server (i.e. my mac with mamp) and on a remote server (i.e. my hosting provider). I want to keep the two sites synchronized. My hosting provider does not allow ssh keys. I have already tried the drush aliases way, but with no success at all - I keep getting the message "no alias record could be found for source @.... So please, my question is this: What is the best and easiest way to keep the two versions (local and remote) of the same site synchronized?


texts: REST User Registration API, How to handle validation

texts:
I am new to D8, Building an application with Drupal 8 REST and REST UI contrib module. Since 8.3 User Registration API is available. But if validation fails, it throws below error :

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

While I checked, recent report from Admin -> report section. It says : Unprocessable Entity: validation failed. mail: The email address abc@example.com is already taken. which is as validation in API fails.

But, How do I send a 400 (Bad request) with respective error message in response?

Any configuration or need to set something through a custom module?


texts: How to delete a large amount of nodes effeciently during cron?

texts:
I implemented hook_cron() to delete nodes older than 30 days using node_delete function. Tracing the performance displays this:

  2015-07-06 21:28:49 Drupal watchdog
  ApCleanup::node_delete|/fpe/article||0||Node ID 423466 has been
  deleted [1.1173 secs]
  request_id="v-b8288e7a-2415-11e5-b14b-22000aeb06a5"

A single node deletion takes 1.1 sec. What is the most efficient way to delete the (2075546) nodes using hook_cron() and the node_delete_multiple function?


texts: How to use Devel module to see what creates an URL?

texts:
I want to know what creates an URL of a site for example a view,panel etc.
Which command should I write on the Devel module on "Execute php" ?
Thanks


texts: In a content creation form, can one field acquire its default from another?

texts:
I have a content type with the following fields:

Name (text)
 Image1 (image)
 Field set (field_collection)
 Image2 (image)
Description (text)

I would like the value of image1 to become the default value of image2.
Another option is to hide Image2 if Image1 has a value.

The Field Collection is set to have unlimited instances.

I've examined conditional fields which looks like its logic won't cross the field collection boundary.

Is there a way to do this that I've missed?