texts: What is the purpose of drush entity-updates?

texts:
After updating Drupal 8 modules, I have been warned on the Drupal 8 status page that:

  Entity/field definitions: The following changes were detected in the
  entity type and field definitions.

After a bit of Google rummaging, it seems the solution to this is to run drush entity-updates. However I find this a bit strange as it seems to be another command that one needs to remember or incorporate into one's workflow after updating the database, not to mention it didn't seem immediately obvious about how to address the original warning.

What's more, it's often the case that in development you'll have an alert for other actions in the Status page which will mean you won't immediately know if you need to action this.

Can anybody explain what is this warning is for - or rather, why has this feature been introduced into D8, and why isn't it factored into the database update operation but must be run seperately?


texts: How to add parameter to URL when passing ids as arguments to a page?

texts:
I have a view with an action Pass ids as arguments to a page where I need to add to the link. There is a parameter which I receive in the URL. I can print the parameter in the view, but I am not able to pass it as a token. It is not parsed.

Any ideas?

Basically I need to duplicate a node and assign to it a dynamic list of properties (other nodes). I created a view and added a VBO field. User select the ids and they get passed to my URL for elaboration. So far so good. My problem is that I need to pass, in addition to the ids, another field from the view. I tried to specify it in the URL /admin/myurl/[my_field], but it doesn't parse the token.


texts: Render value of custom content type in html.html.twig

texts:
is there a way to render a value from a node of custom content type in html.html.twig?

E.g. in my custom content type "book" I have a field called "author_name". I now like to render the node value of "author_name" anywhere in html.html.twig.

Is this somehow possible using just twig? I tried a few things with extends, embed, include etc, but nothing worked so far.


texts: Url aliases/global redirect not being used in Custom Blocks

texts:
This one's weird.  Drupal 7.

I have a complex front page - lots of Views, also lots of custom blocks using code I wrote from scratch - functions that essentially query the database directly and output different lists of content.

For some reason, these custom lists aren't using the generated url aliases.  They just link to node/#####.  Further, Global Redirect isn't working for them either.  What gives?

To see in action: http://www.ainonline.com.

You'll see most of the top stuff has the generated aliases.  The ones in the middle towards the bottom, under the individual channels, use the system urls.  Any ideas?


texts: How to alter cck field title using hook_form_alter?

texts:
I want to change #weight, #prefix, #title for a cck field.

First I tried the following code.

function test_form_taxonomy_form_term_alter(&$form, &$form_state, $form_id) {
    //Working
    $form['field_test1']['#weight'] = -5;
    $form['field_test1']['#prefix'] = 'This text will rule them all!';

    //Not working
    $form['field_test1']['#title'] =  'test title';
    $form['field_test1']['und']['#title'] = 'test title';
    $form['field_test1']['und'][0]['#title'] = 'test title';
}

It is working good with #weight, #prefix elements.

//Working
$form['field_test1']['#weight'] = -5;
$form['field_test1']['#prefix'] = 'This text will rule them all!';

But not working for #title element in anyways.

$form['field_test1']['#title'] =  'test title'; //Not working
$form['field_test1']['und']['#title'] = 'test title'; //Not working
$form['field_test1']['und'][0]['#title'] = 'test title'; //Not working

I tried with #after_build as well but no luck.

function test_form_taxonomy_form_term_alter(&$form, &$form_state, $form_id) {
    $form['#after_build'][] = 'test_after_build';
}
function test_after_build($form, &$form_state) {
    //Working
    $form['field_test1']['#weight'] = -5;
    $form['field_test1']['#prefix'] = 'This text will rule them all!';

    $form['field_test1']['#title'] =  'test title'; //Not working
    $form['field_test1']['und']['#title'] = 'test title'; //Not working
    $form['field_test1']['und'][0]['#title'] = 'test title'; //Not working

    return $form;
}

Please give me the solution for alter cck field title through form_alter.

Thanks in advance,
Logan


texts: Configuration export via drush randomly change the value of labels\other content in multilanguage sites

texts:
I've a multilanguage site, with Italian set as default and English as secondary language.
When exporting the configuration via drush - drush cex command - sometimes the labels of other kind of content is exported, but the only actual difference is the change of language.
This happens often with a lot of views.
For example, for views.view.who_s_online.yml the difference is:
 @@ -41,7 +41,7 @@ display:
          submit_button: Apply
          reset_button: false
          reset_button_label: Reset
        - exposed_sorts_label: 'Sort by'
        + exposed_sorts_label: 'Ordina per'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc

But there are other settings, for the "en" translation that sometimes differs only for the translation.
E.g. for en\field.field.node.article.body.yml the difference is:
 @@ -1,0 +1,0 @@
 - label: Abstract
 + label: Body

This is frustating because I often have to check a lot of files with no real difference. For some is actually dangerous as e.g. en\addtoany.settings.yml keeps to lose its settings during the export.
When this happens I've tried both to commit the exported files with just the language differences, or to discard them and to import the configuration (drush cim).
Neither of the solution are working long-term, as the problem appears again after a bit.
I've checked for possible issues on the drupal issue queue but found nothing. Any help?


texts:
I'm turning one of my sites into a multi-lingual site, everything seems to work fine, only some fields where the Node Reference module was used don't seem to translated, even though the referenced node is translated to both languages.

Is there a fix for this? Or would I have to change something myself in order to get this to work?


texts:
I need to have a full screen image carousel and I'm using a sub theme of omega.

Ideally, I'd like to render the image through a custom module which I have put in the branding region.  Because the images needs to be full width I need to render the branding region outside the grid.

What's the best way to go about removing the branding region from the grid and rendering it outside?

Thanks,


texts: Ajax callback called on textfield typing

texts:
I'm trying to reach exactly the same state as autocomplete field does. When user is typing in textfield I'd like ajax to wait with its callback so the user can write all the text.

I'm trying to achieve it with help of this question. But I'm failing. Maybe because I'm playing with JavaScript in drupal for the first time. Anyway here is my code.

form_alter in .module (I have form generated with features)

if (empty($form['nid']['#value'])) {

    drupal_add_js(drupal_get_path('module','MY_MODULE') . 'my_script.js');

    $form['field_my_field']['und'][0]['value']['#ajax'] = array(
        'callback' => '_test_callback',
        'event' => 'finishedinput',
    );
}

my_script.js (from the link above)

(function ($, Drupal) {
Drupal.behaviors.MY_MODULE = {
    attach: function (context, settings) {
      var typingTimer;
      var doneTypingInterval = 10;

  $('.andtimer').on('keyup', function (e) {
    clearTimeout(typingTimer);
    if ($(this).val) {
      var trigid = $(this);
      typingTimer = setTimeout(function(){
        trigid.triggerHandler('finishedinput');
      }, doneTypingInterval);
    }
  });
}
};
}(jQuery, Drupal));

And I have script attached to my .info file.


texts: How do I update existing Nodes field through Import without having to delete all content and re-importing everything?

texts:
We built an application for a client of ours to track appeals and cases of a legal case. There are currently over 2,000 entries in the system. After we built the app, it was requested we add four more fields for allocation amounts. We added the fields, but he would like to now import the content (which he has already put in a csv format, in proper order for an import).

We originally used Node Import module to import all of the content (I believe 1700 of the 2000 entries were entered through the initial import). However now that we have added extra fields, Node import does not have functionality to import into empty fields, mainly I believe because it does not have the ability to identiy unique identifiers and see that an entry already exists for that Node title.

Node Import Update module, from what I read in the description of the module should be able to do it. However after installing this module and doing the import again, it does not work, instead it creates duplicative entries.

In Node Import Update module's known issues page (http://drupal.org/node/813978), it says one needs to go in and update the node type you want to import. I do not know what value it is asking for here. The name of the Content Type in which the fields are in? This is what I currently have it set to. I know Title is correct - not sure about the node type:

Set custom data
     * These should/could be defined in admin
     *
     */
    // Node title as unique identifier
    //$IMPORT_UNIQUE_ID_NAME   = 'title';               // Import field that holds the unique identifier
    //$IMPORT_UNIQUE_ID_IS_CCK = FALSE;                 // Is the identifier a CCK field?

// CCK field as unique identifier
$IMPORT_UNIQUE_ID_NAME   = 'title';  // Import field that holds the unique identifier
$IMPORT_UNIQUE_ID_IS_CCK = FALSE;    // Is the identifier a CCK field?

$IMPORT_NTYPE            = 'node';   // Node type to be imported
$IMPORT_UPDATE_DATETIME  = TRUE;        // Settting: update date/time value?

Sorry if it is long winded - however I wanted to ensure I was complete in describing the issue as I really need to get this wrapped up for my client. Thanks!!!


texts: "See Also" section inline node body text

texts:
I am not sure the title of my question specifies correctly what I am looking for, but several newswebsites are using some sort of "See Also" or "Don't Miss" sections which appear between the first and second paragraphs on their articles and links to a related article. In my opinion it's a great feature as it can keep visitors longer on the website.

I have been looking to implement this on my D7 website but there seems to be no easy way to add a custom field or something in node body text. Any help would be appreciated

Here are some examples:

http://mashable.com/2017/01/23/hospice-patient-attends-womens-march
http://bgr.com/2017/01/23/ios-10-2-1-release/


texts: Delete all nodes of a user using flags and rules

texts:
I want to delete all nodes for a user whoes any one node has been flagged as spam.

For example:

If user has created 3 nodes of same/different content types, then If admin flag any one content as spam, then all the 3 nodes should get deleted and the user should get blocked.

I am able to block the user and delete the flagged node but not the other 2 nodes. I want to delete all nodes associated to that user.

Please help.


texts: Will the Search API increase performance of searches in the Views Exposed filter?

texts: How to increase the performance, if one of the main activities on a website would be searching in Views exposed filters? Will the Search API module (with Database Search/not Solr) significantly increase the performance of such searches?


texts:
So far I have been using this code, which works fine to print third-party module blocks.

<?php
    $block = module_invoke('views', 'block_view', 'og_members-block_1');
    print render($block);
?>

However, now I am trying to print a block that lives within my theme folder and I can't seem to figure out how to do that. How can I achieve this?


texts:
When i used the Cache Expiration module i noticed that the Cron Cache module is no longer working and the cache tables in the database are no longer flushed so the database size is getting bigger day after day .
Is there any solution for that?


texts: Automatically update Drupal core/modules for a large number of sites (with Drush)?

texts:
I'm the administrator of a lot of Drupal websites on different hosting providers.

Some have drush; others don't (and can't: like shared hosting).

Every time there is a Core upgrade, I spend 1 or 2 hours updating everything (I make a backup of every website before an upgrade).

Updating sites with Drush is simple, but I need to do it for every website, like :

drush @dev up
drush @othersite up
and wait... wait... wait...

How can I automatically update Core (and modules) on:

all my drush sites ? (I think : cron with bash script)
all my non-drush sites ?

Is this safe, or do you not recommend it?


texts: Create an author archive page with views

texts:
I have two content types: article and author. The author content type has a bio, links to facebook and twitter etc. This author content type is connected to the article content type with an entity reference. I want to create a page that displays the author content at the top and then below that, a list of all the authors most recent articles.

I am trying to make a view block with a contextual filter to drop into the author page, but I cannot get it to work. I dont really understand views that well. Can anyone give me some pointers on what I need to do to set this up?


texts: How do I get an entity reference parent using tokens?

texts:
Setup

I have an entity reference chain that is kind of complicated. It's basically using Drupal to build a dynamic database with nodes being the tables and entity reference acting to store external keys.

An example might be:

Video Games - name, genre, description, release (entity reference)
Release - name, release type, region, release date

I am using Node Title Auto module to populate the title of the release with [Release Type] [Region] if the title is left empty. For example a release may look like: "Normal US"

The Problem

I would like to change that title to use the parent node name like [Parent Entity:name] [Region] So the release title would look like: "Pokemon Red US"

The Question

How do I find the parent node given an entity reference field? I know there could be multiple parents but I'm ok with just taking the first one or whatever. It's mostly just present to help autocomplete fields and views presentations.

I considered Computed Fields module but it stores PHP in the database which is always a bad idea.
I also installed the Entity Reference Tokens module but it doesn't seem to have parent relationships.
I'm confident this is possible as I have already done something similar in views.


texts:
I am using profile2 field as user reference and also i filter results with an entity selection. The widget used is an autocomplete and i have a problem with it. If i type in the nid of a user the result returned is correct, but it does not work if i type in the name of the user or anything else related to it besides nid.

Example:

for this url everything is fine ( returns the name of profile with nid == 1):

entityreference/autocomplete/single/field_test/profile2/profiletype/NULL/1

but if i type "name" the result is null

  entityreference/autocomplete/single/field_test/profile2/profiletype/NULL/name

Is there any configuration that i miss ? Is it possible to change the behavior of autocomplete ?


texts:
I use MailManager to send emails to end users for notifications. I would like to override the email address shown to the end user, using a "fake" address shown and not the real mail account used to send the email. I use the following code, however, in my gmail receiving account I don't see the noreply@mymailserver.com but the real email account used.

$params['message'] = $message;
$params['subject'] = $title;
$key = 'send_email';
$langcode = \Drupal::currentUser()->getPreferredLangcode();
$send = true;
$result = $mailManager->mail($module, $key, $targetEmail, $langcode,
                    $params, 'noreply@mymailserver.com', $send);

Is there a way to define a custom address to be shown to the end user? Am I missing something?


texts: How to fix "GeoType" plugin does not exist

texts:
I'm following this tutorial. I've installed the geofield module and all needed for it wo work. I finally manage to create a content type "Place" with a field of type geofield. When i then create a new content of type "Place", i get the following message on drupal 8.0.3:
The website encountered an unexpected error. Please try again later.

  Drupal\Component\Plugin\Exception\PluginNotFoundException: The "GeoType" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 57 of C:\wamp\www\drupal8\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php)

I'm using drupal 8.0.3
with geofield 8.x-1.0-alpha1
Note i also habe geoPHP enable.
Any idea how i can solve this issue?


texts: Views: Apply a wrapper to every 3 and 6 group of rows

texts:
My Views Output is as follows

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

I would like to put a wrapper around every 3 and 6 group of Views rows.

So my mark up would look like this:

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

How can I do this? I know that I have to use views-view-unformatted.tpl.php but I am not sure how to alter the $row variable to target every 3rd and 6th group.

Thanks in advance for any help that can be offered.


texts: drupal_goto ignored in custom form submit handler

texts:
I'm working on a site at the moment where some nodes are hidden behind a login. You can see a list of them, but to view them you need to sign in.

The sign in is done by showing the user login block in a lightbox.

Now the problem I'm having is the submit handler for the form isn't working properly. In my template.php file, it looks like this:

function fisita_redirect_after_login(&$form, &$form_state) {
   drupal_set_message($form['hidden_paper_url']['#value']);
   drupal_goto("http://www.google.com");
   //$form['#redirect'] = $form['hidden_paper_url']['#value'];
   //$form_state['#redirect'] = $form['hidden_paper_url']['#value'];
}

The Drupal set message, works fine, and it is outputting what I want (the URL we're trying to redirect to), but any attempt at changing the page isn't running. Either redirect or drupal_goto.

Does anyone have any clues?

Thanks


texts: Get dynamically created image URL in a block with paragraph and media bundle

texts:
I have seen a lot of related answers to this question but nothing specific to my issue - apologies in advance if it has already been answered.

In Drupal 8, I have a custom block type that references a Paragraph type.  The Paragraph has a field that references an image media bundle.  So it looks something like this:

Block-> ReferenceFieldForParagraph-> Paragraph-> ReferenceFieldForMediaBundle-> MediaBundle-> ImageUploadField

I need to apply various image styles to that image and then get the URL for each image.

In the Paragraph's Display, I have set the field that references the media bundle to display Thumbnail: Original Image
I have created a twig template for the paragraph bundle and I am able
to generate my various images by doing the following:

The media bundle reference field is named field_slide_image:

{% block paragraph %}
  {% block content %}

    {# set the styles #}
    {% set image1 = content.field_slide_image.0|merge({'#image_style': 'style1'}) %}
    {% set image2 = content.field_slide_image.0|merge({'#image_style': 'style2'}) %}
    {% set image3 = content.field_slide_image.0|merge({'#image_style': 'style3'}) %}

    {# render images #}
    {{ image1 }}
    {{ image2 }}
    {{ image3 }}

  {% endblock %}
{% endblock paragraph %}

I cannot figure out how to get the URL.  I have tried to use file_url() but I don't see any reference to the uri when I use kint.  In other words, something like this doesn't work:

{% set image1 = content.field_slide_image.0|merge({'#image_style': 'style1'}) %}
{% set uri1 = file_url(image1.uri.value)  %}
{{ uri1 }}

I need the url's so that I can create a custom responsive image using the picture tag.  I need to generate this dynamically because I have another field (select box) that specifies the dimensions of the images (ie the image styles).  For example, option 1 is a 1x1 ratio, option 2 is a 3x4 ratio, etc.  I could easily print all images and set up media queries to hide/display them but I don't want to resort to that if I don't have to.

Here is what I see when I kint image1

Thanks in advance


texts: Views slow load time with date contextual filter

texts: We have a Drupal site with a view of events content type (which is a list of events happening around the area). There is a display with a date contextual filter that you can filter based on a single or range of dates to return events during that time. There is another display with taxonomy term contextual filter that you can filter based on a specific category. The display with the date contextual filter takes ~32s to load compared to display with taxonomy term contextual filter which takes ~8s. Both seem very high. We can't figure out why this is the case since they are in the same view. We tried to enable view cache but I don't that would work since it's contextual filter based. Any suggestions/ideas?


texts: How to show an error message when form validation fails if form added to page with formBuilder->getForm()

texts:
I have a number of pages in my Drupal 8 application where a template is returned from a controller method, and that template has a number of forms on it.  I build the form in the controller method using formBuilder->getForm(), and then I set that output to a theme variable which the template renders.  So something like this:

Render Form

$addDocumentForm = \Drupal::formBuilder()->getForm('Drupal\candidate_portal_candidate\Form\AddDocumentForm');

Add to theme variable

return array(
  array(
    '#theme' => 'candidate_dashboard',
    '#add_document_form' => $addDocumentForm,
    )
)

Render Form in Twig Template

&times;
{{add_document_form}}

This works fine, and seemed like an OK way to put multiple forms on one page.  However, the problem is when there is an error in validateForm() when I submit one of the forms.  Instead of returning to the current page with an error on the page, drupal redirects to a page with only the invalid form on it.

How can I get Drupal to show an error message on the actual page the form is rendered on?


texts:
I'm including the recent blog posts block in the sidebar of my Drupal site which pulls out the 10 most recent posts in a list with the title of the post linking to the post itself. I'd like to pull out more information, specifically the "Authored by" and "Authored on" fields.

What I have at the moment:

    #post title#

What I'd like to achieve:

    #post title#

#author#

#date

The blog_page_last function in blog.pages.inc appears to be where the fields are being pulled out but I can't work out the additional field names (author, date) to enter.

There doesn't appear to be a .tpl.php file in the blog module folder and I can't find anything in blog.module or blog.pages.inc that indicates how/where the markup is set.

Thanks


texts: Saving a view shows "This display has no path"

texts:
I have migrated my website to a new host. Now, the front page logo is missing and  dynamic block contents became static.

On editing a view block, it shows:

  All changes are stored temporarily. Click Save to make your changes permanent. Click Cancel to discard your changes.

On updating the preview, it shows "This display has no path."

How can I fix this?


texts: Why my block does not appear on specific page?

texts:
I have a menu. This menu is a block: my_block_menu.

I want to assign my_block_menu certain pages, not all. For this, I'm going to block Visibility options and select Only the listed pages.
So, I write the pages path. Result: The block appears on all pages, except one listed. Why block on this page does not appear?

After trying many things, I tried the PHP option (experts only). And I put this code:

$a = 1;
if (!empty($a)) {
    return true;
}
else return true;

Result: Block not shown in this page!
What's going on? I'm going crazy!


texts: Cannot add content using default content types

texts:
I have Article and Basic Page, but when I try to add either of these to my Drupal Site I get the following error message.

  You have not created any content types yet. Go to the content type creation page to add a new content type.


texts: Customization of Facebook style Statues module

texts:
I am using Drupal 7 with Facebook-style Statues module.

While writing the status I would like to load the URL when user paste any URL, just like facebook.

Is there any way to customize this module or do i have to build entire new module.


texts:
I have downloaded the latest version of Drupal 8 my project structure looks like:

private/
  EntityOne.php
  EntityTwo.php
  Test.php => Test Script (Eventually AUT)
public/
  index.php => Drupal Engine

Inside Test.php I wish to begin building a series of entities which at first will be used externally and eventually be moved into Drupal modules.

I have Googled and spent hours trying to get Doctrine to start letting me build tables with my entities, but I am doing something wrong.

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html#obtaining-the-entitymanager

Is of no help, there is no "vendor/autoload.php"  but there is a "core/vendor/autoload.php"

I can include this file in Test.php and everything is fine but when I start adding code:

  include '../public/core/vendor/autoload.php';

  use Doctrine\ORM\Tools\Setup;
  use Doctrine\ORM\EntityManager;

  // Create a simple "default" Doctrine ORM configuration for Annotations
  $isDevMode = true;
  $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src"), $isDevMode);

I get an error:

Fatal error: Class 'Doctrine\ORM\Tools\Setup' not found in ...\private\index.php on line 10

There is no "Doctrine/ORM"

What am I missing???

Alex


texts: Performance - custom php block or views to use in panels

texts:
I use panels to display block with node title on a custom position. My question is about performance - what is faster - to use following php code inside block

<?php
$node = menu_get_object(); print $node->title;
?>

or to use use views to get title of current node.
Thank you


texts: How to add time element to open date and close date when adding a quiz

texts:
I am using the following modules.

Quiz, Version 7.x-4.0-rc2
Date, Version 7.x-2.9

When adding a quiz, in the availability options tab, I want to be able to set the time as well.

In the open date and close date, there should be an hour and minute option as well.

I did the following things.
1. In the hook_form_alter(), added the below code

if($form_id == 'quiz_node_form'){
  $form['quiz_availability']['quiz_open']['#type'] = 'date_select';
}

This gave a warning on the node/add/quizpage.

  Warning: strlen() expects parameter 1 to be string, array given in
  date_default_date()

2.So added a patch in date_api_elements.inc
https://www.drupal.org/files/date-element-default-value-2038057-1.patch
This removed the warning but upon adding the date and time in the availability options and saving the form, it throws the huge error below.

  Please supply a valid date. PDOException: SQLSTATE[01000]:

  Warning: 1265 Data truncated for column 'quiz_open' at row 1: INSERT INTO {quiz_node_properties} (vid, nid, aid, number_of_random_questions,
   max_score_for_random, randomization, backwards_navigation,
  repeat_until_correct, quiz_open, quiz_close, takes,
  show_attempt_stats, keep_results, time_limit, pass_rate, summary_pass,
   summary_pass_format, summary_default, summary_default_format,
   quiz_always, feedback_time, display_feedback, tid, has_userpoints,
  userpoints_tid, allow_skipping, allow_resume, allow_jumping,
   show_passed, mark_doubtful, max_score) VALUES ....

3.In the hook_node_presave, printed the $node.

It stores the date as below.

  [quiz_open] => 2016-05-12 21:17

but it expects the date to be stored like this.

 [quiz_close] => Array(
      [month] => 6
      [day] => 11
      [year] => 2016
    )

How to store the date as an array or is there an alternative solution to the problem.


texts: How disable view page functionality and revert to pure view with master display?

texts:
On view setting page

I have view with menu link and path. I want to turn it off, revert to basic view master. I've try to remove menu, but didn't change anything. Then I try to remove path but is mandatory. Clone view make same view with page path.
Only solution I can see is create new view and repeat settings (I don't want to do that!), another is to just change path to some useless one so it dons't conflict with my menu links (paths). Any ideas?


texts: Replacement for Drupal 6's $form_state['post'] in Drupal 7

texts:
I have the following code (part of a module):

function whm_ui_edit_account_form($form, &$form_state, $account) {

  $res = whm_account_info($account);
  $account_data = $res[0];
  $current_state = array('values' => array(
    'user' => $account_data['user'],
    'domain' => $account_data['domain'],
    'email' => $account_data['email'],
    'plan' => $account_data['plan'],
  ));
  $form_state['values'] = array_merge($current_state['values'], $form_state['post']);

  $form = _whm_ui_account_form($form_state);
  $form['account']['password'] = array(
    '#type' => 'fieldset',
    '#title' => t('Change Password'),
    '#description' => t('Enter values here <b>ONLY</b> if you want to change this account\'s password.'),
    '#collapsible' => TRUE,
    '#collapsed' => empty($form_state['values']['pwd1']) && empty($form_state['values']['pwd2']),
  );
  $form['account']['password']['pwd1'] = $form['account']['pwd1'];
  $form['account']['password']['pwd1']['#required'] = FALSE;
  $form['account']['password']['pwd2'] = $form['account']['pwd2'];
  $form['account']['password']['pwd2']['#required'] = FALSE;
  unset($form['account']['pwd1']);
  unset($form['account']['pwd2']);
  unset($form['account']['email']);
  unset($form['account']['plan']);

  $form['current_user'] = array(
    '#type' => 'hidden',
    '#default_value' => $current_state['values']['user'],
    '#required' => TRUE,
  );
  $form['current_domain'] = array(
    '#type' => 'hidden',
    '#default_value' => $current_state['values']['domain'],
    '#required' => TRUE,
  );
  return $form;
}

The $form_state['post'] no longer exists in D7 (I'm porting an old module) and perhaps I'm insanely tired or just out of my depth :-p but I can't find a suitable replacement. The function is essentially looking to merge existing information with the information given in the form before submitting (I think).

Any assistance or if anyone can point me to an alternative to the post value being used previously it would be appreciated.


texts: How to embed videos using the video module?

texts:
I installed the video module and activated video and video ui modules using Drupal 7:
https://www.drupal.org/project/video

I created a content type with a video field. Now I can upload videos with this content type.

But I am not able to embed a youtube video. I can not find any settings or any embed widget as shown here.

I want to upload videos and I want to embed videos (youtube, vimeo..).
But I can not find any way to embed a video unsig this video module.

Do I have to install further modules?
On the module page you can read:

  Video module allows you to embedded videos from YouTube, Vimeo,
  Facebook, Vine etc (Drupal 8 only) and upload videos and play using
  HTML5 video player.

I can not find out how to embed a video using this module. Can you help?
I do not want to use another module, I want to find out how to embed videos using THIS module. Be in mind of this when you write your answer. Thank you.


texts:
I want to get all the logs, which are available under admin/reports/dblog as shown in the screenshot below:

Below are the two approaches, I can think of:

Access logs programmatically in Python or PHP
Download the database as a SQL file and read the database

I am not sure if the above approaches are possible or not. Any suggestions, please?


texts: Using Rules to Prune Inactive Users - will this work?

texts:
I am relatively new to Drupal and learning as I develop a new website for our network of chapters. Needless to say, that has been quite the challenge :)

One of the functionalities I needed was the ability to prune inactive users. We have this on our current system and like having it to keep our membership numbers accurate, as well as help our members feel more "secure" by knowing only active members have access to the chapter.

There were a couple of modules out there to do this, but they were all for Drupal 6 or only had development modules for Drupal 7.

I found this link:
https://drupal.org/node/1582710

and have followed it to set up my own "prune users" using rules. But I have NO idea how to test this in the development stage and certainly don't want it to screw up and accidentally mess up memberships when we move to the live versions.

What I have done is as follows:

Set up the following components:

Send email stating user has been inactive for 30 days and schedule next letter in 30 days
Send email stating user has been inactive for 60 days and schedule next letter in 25 days
Send email stating user is in danger of being pruned and must login to keep account and schedule blocking user in 5 days.
Block user

Set up the following rules:

Inactive User: When user logs in, remove all currently scheduled rules and set component evaluation for inactive for 30 days letter.
Never Logged In: When user account is first approved, set component evaluation for inactive for 30 days letter.

I think this means that when a user first signs up, they will get scheduled for the inactive user letter. Every time they log in, it will reset to the 30 day letter in 30 days. If they never log in, in 30 days, they will get the first letter and the 2nd letter will schedule... until they are pruned. If they log in, everything resets.

I know this means that every user will have a scheduled inactive user letter task -- not sure if this will bog down my system too much?

Also, if this does sound right -- how do I go about testing it to make sure it works the way it is supposed to and doesn't accidentally block users its not supposed to?

One last thing -- what can I do to automatically delete the users that are "blocked" and have been members for a certain amount of time (to ensure that new members who are just not approved yet don't accidentally get "pruned"?)

If I have made a complete mess of this, please feel free to tell me so! Like I said, I am really new at this and still figuring it out as I go along... I appreciate any help you can give me!


texts: Drupal on IIS 7: URL Rewrite vs. ISAPI Rewrite modules

texts:
I'm preparing to install Drupal 6 on an Win2k8 server. I'm still on the fence about using IIS 7 exclusively as the web server, or installing Apache and avoiding IIS 7 altogether. I work on a campus with a lot of different networks & system which mostly run on Windows servers, so I fear that not utilizing IIS 7 in some form may come back to bite me later on.

Anyway-one of the main issues I've seen from folks who've installed Drupal w/o Apache is in configuring clean URLs & URL rewriting. I'd like to ask if it is any easier setting up URL rewriting with the MS URL Rewrite vs. an ISAPI Rewrite module? Is there a major difference between the two modules other than that the full-feature ISAPI modules seem to cost money?

Thank you.

Jason


texts: Disable email to admin on new user registration

texts:
When a new user registers, an email is sent to the admins. I can't work out how to turn this off. There doesn't seem anywhere where I can alter it.
In Home » Administration » Configuration » People » Account settings

Who can register accounts? "Visitors" is checked (not "Visitors, but administrator approval is required")


texts:
I'm working on a module that accepts user-specified paths for special treatment. I want to have a validation step where I check whether that path actually exists on the site.

Is doing a query to the menu_router table sufficient? Is there a better way -- say, a Drupal function -- to validate a url?


texts: Block a single basic page from authenticated users

texts:
I have a website with a couple of pages and organic group pages. I'm trying to deny access to one "basic page" for authenticated users. (I only want anonymous users to see the page). Every module I've downloaded seems to mess up my permissions and stuff set up for my other pages and views. Is there any simple way to do this?

I've tried content access and node privacy by role.


texts: Adding a css in preprocess view not woking

texts:
I'm trying to add a css to a view, through the preprocess view as below

function mytheme_preprocess_views_view(&$vars) {
 $view = &$vars['view'];
if ($view->name == 'gallery_view') {
drupal_add_js(drupal_get_path('theme', 'mytheme') . '/assets/js/responsive-image-gallery/gallery.js');
drupal_add_css(drupal_get_path('theme', 'mytheme') .'/assets/css/responsive-image-gallery/style.css');
 }
}

The Following code above is inserting the js file but not the css. Is there a reason why? Or other way to insert css file in certain view?

I have tried the following and its being inserted:

drupal_add_js(drupal_get_path('theme', 'zenon') .'/assets/css/responsive-image-gallery/style.css');

So is there something missing in the drupal_add_css function or it doesnt have read access on the server, is that possible?


texts: Suddenly I can't use the "Media" file uploader in Full HTML CKeditor edit screen but can do in Filtered HTML edit screen

texts:
I Use D7, CKeditor v 1.16.7 and Media v 1.5.7, all other modules are up2date and the site itself works fine.

I don't recall any special change at the site that would avoid this module of working, yet suddenly it's upload button was removed from CKeditor's Full HTML palette (img 1) while appearing fine in Filtered HTML palette.

Facts:

The CKeditor "Full HTML" profile's settings seems just fine (img 2).
Permissions are fine (I'm the Admin, img 3).
Rebuilding type information for media, didn't help.

Any ideas?


texts: Tokens missing in Webform Emails after upgrading

texts:
Currently running Drupal 7.69 / PHP 7.3 (+ CiviCRM)
I have recently updated some Modules : Webform, Views Bulk Operations, i18n, and Content Access.
Since then, my Webform Emails do not show the pertaining tokens (but they just show the token titles) :
All those tokens are not populated :
[submission:completed_date:long],
[submission:user],
[submission:values],
[submission:url]
Any help is welcome


texts: I'm using the built in search in Drupal 7. My problem is that I need to customize the search page. Is it possible to get the search results into a panel so that I can output my main menu and a few other elements? Now My search result page is very bare.


texts: I want to theming only preview pages on Webform. Is it possible?


texts: I am currently using services module and I have an android app. I am logging in using the login api, and I can go all the things provided by services. However after a few hours or few days, I can no longer use the api because it says I am not logged in. If there a way for me to keep the user logged in until they log out manually?


texts:
I want to make some modifications to the bartik theme i am using D8
(like changing the logo position,etc) i created a subtheme
named it "mytheme"
following the instruction i found here:

https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme

So, first I created the mytheme.info.yml file containing:

name: mytheme
type: theme
base theme: bartik
description: subtheme for bartik
core: 8.x
libraries:
  mytheme/global-styling
regions:
  header: Header
  primary_menu: 'Primary menu'
  secondary_menu: 'Secondary menu'
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  highlighted: Highlighted
  featured_top: 'Featured top'
  breadcrumb: Breadcrumb
  content: Content
  sidebar_first: 'Sidebar first'
  sidebar_second: 'Sidebar second'
  featured_bottom_first: 'Featured bottom first'
  featured_bottom_second: 'Featured bottom second'
  featured_bottom_third: 'Featured bottom third'
  footer_first: 'Footer first'
  footer_second: 'Footer second'
  footer_third: 'Footer third'
  footer_fourth: 'Footer fourth'
  footer_fifth: 'Footer fifth'

Next i created the mytheme.libraries.yml containing the following:

global-styling:
  css:
    theme:
      css/style.css: {}

i went to appearance and enabled "mytheme" as default, went back to site, looks identical to how bartik was
so far so good

my problem now is, how do i move on with the customizations i want to do?

i created a folder called: "css" in "mytheme" directory, inside the css folder i created a blank file called "style.css" and
there i wrote the first modification i want to do

.region-header .site-branding {
    float: none;
    text-align: center;
}

When i go back to site i see no difference, the logo remains on the left like it was on bartik

Can somebody help please?

I am not sure how to proceed and if what I did by creating a css folder, etc is the right way.

Thank you.


texts: How to insert a link in a private message by code?

texts:
I am sending a message to some users when a specific function is created. However, the content of the message that I send is always in plain text, meaning that it does not render links. What can I do?

This is the function that I use:

$message="A user has requested to join your group ".$group->title.". You can go to the group's page now to approve or decline their request.";

privatemsg_new_thread(array($user), 'New membership request for '.$group->title, $message);

I would this to work:

$message="A user has requested to join your group ".l($group->title,'group/'.$group->gid).". You can go to the group's page now to approve or decline their request.";

Any suggestions?


texts:
I'm searching for a PDF viewer for Drupal 7 which doesn't renders as a Mozilla Firefox PDF or a google's PDF.

Does someone know anything that I could use?


texts: Altering button title it becomes inactive

texts:
The override function I use in my bootstrap sub-theme template.php:

function subtheme_form_titles_node_form_alter(&$form, &$form_state) {
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Activate'),
  );
}

I use this, so I could replace a default 'Save' title of the button to 'Activate'. Funny thing is that it does replace the button title, but then when using the form and trying to save it by pressing 'Activate', nothing happens, the page just refresh, but content doesn't get created.

Also for some reason it change button class from btn-primary to btn-default. This shouldn't be happening. I just want to replace button text and keep default btn-primary class.


texts: Custom Theme - Add page specific meta tags / title to pages

texts:
I am new to Drupal, but I am very familiar with WordPress.

In WordPress, I am able to hook into the head of a document with wp_head to add things like page specific meta tags.

When using a custom theme based on Stable, how would you add page specific things in the <head> of a document in Drupal 8?

Note: I am wondering how this would be done without a custom module.


texts: How to user custom views filter when ajax is enabled

texts:
I created a view. And I created a custom filter in a module via hook_views_pre_render.

In this view I have and exposed filter and ajax in enabled.

When the view page is loaded it works perfectly, but when I use the filter doesn't work any more cause the hook_views_pre_render is not invoked.

How can I make this filter work even when ajax is enabled?

A views filter plugin is suggested, I looked at the tutorial on webomelette but I don't understand how I can change my custom filter to a views filter with the plugin. I want to remove all duplicate results in the same month. I tried all the standard views solutions but they don't work so I need a custom module to do this. This is the code I've written:

//I create an array to save for all nodes
$nodes = [];

//I loop through all view results
foreach ($view->result as $i => $val) {

  /* REMOVE DUPLICATE RESULT IN SAME MONTH */

  //get nid
  $nid = $val->node_nid;

  //get month
  $month = explode('-', $val->_relationship_entities['field_datum']->get('field_begin_datum')->value)[1];

  //set month-id code
  $idmonth = $nid . '-' . $month;

  //if current nid in same month is already in array
  if (in_array($idmonth, $nodes)) {
    //unset this duplicate result
    unset($view->result[$i]);
  }

  //else
  else {
    //save nid and month in array
    $nodes[$i] = $idmonth;
  }

  /* END */
}

Thanks in advance


texts: How to change commerce order owner to someone else?

texts:
I create a commerce order for a spesific user prograticaly by admin user, after completing checkout process by admin, I want to change owner of order to someone else to show created order in order history of spesific user
I changed the uid of order but does not work for me.


texts: How do I access field variables directly in Drupal 7 without having to drill down into a node array?

texts:
I have a view reference field and have some php code in the view where it grabs the taxonomy ID of the page its currently on. Currently I am grabbing the TID via

menu_get_object()->field_device_type_vocabulary[und][0][tid];

I know you can access the fields directly without having to do that, but forgot how that was done.


texts: Webform how to pass that SUBMITTED TO value through hidden field in a form submission?

texts:
In Drupal 8 I have created a job application form using webform module. I have created a Jobs content type and created few jobs like Job A, Job B, Job C and in each job the same form is used.

When we submit the job application for different jobs and check the results on submissions page

admin/structure/webform/manage/apply_for_job/results/submissions

it shows us the SUBMITTED TO column under which it shows for which job this submission is.

I want to know how to pass that SUBMITTED TO value through hidden field in a form submission?


texts: Drupal Commons on D6 - Visibility of 'Group members' and 'Latest group activity' blocks

texts:
Out of the box the 'Group members' and 'Latest group activity' blocks on the main page of a group are visible to all users regardless of whether one is a member of that group or not.

How can both blocks be displayed only when a user is a member of that group?

Thank you,

Alex


texts: How do I get a list of all taxonomy terms assigned to a node?

texts:
I have a node and want to get all the taxonomy terms assigned to the node.

In drupal 6 I could use $node->taxonomy and the taxonomy_* functions but these don't exist in drupal 7.


texts: Create relationship between node and menu link

texts:
I would like to create a node with a menu link programmatically.  When the operation is complete, I would like the user to see the relationship between the node and the menu link under "Menu Settings" of the node.

I am aware of this post:

Programmatically create a node with a menu link

This shows the mechanics of creating a node and creating a menu link.  It does not show how to build the relationship between the node and menu link so it is available in "Menu Settings" of the node for a user working with the Drupal GUI.  How can I build this relationship?


texts:
I have succesfully installed solr and it is working fine, but my main search in my drupal site is based on views exposed filters, is there a way to add the solr search in views filters, so it interacts with them?

I am using views to setup an advanced search, by exposing filters, i want to add one that uses solr, so in total solr search is used together with views filter and i get corresponding results from files too.


texts:
I know drupal config:export:content:type is for exporting a content type. Is there a way to do this for a Paragraph bundle?
drupal config:export:paragraph:type doesn't work.


texts:
When my form load I would like to set the focus on the first field in the form. I know I can use jquery to do this by doing $('inout id').focus();. Where would I put this code so that it only runs on a certain form?

Is there a simpler way?

Updated

Using a mixture of smile's answer and clive's comment the code that got it working in the end was:

$form['#attached']['js'] = array('(function ($){$(document).ready(function() { $(".form-item-field-name input").focus()});})(jQuery);' => array( 'type' => 'inline'));


texts: JavaScript snippet displays twice in a block (HTML comments problem)

texts:
I have an ad block with the code served by custom installation of OpenX. Code is presented abridged below.

Fallback

On the live website the code is being transformed as such (adjusted for clarity):

Fallback

So it takes everything between HTML comments and doubles it (inside and outside of the  tag).

Workaround: remove HTML comments from before the snippet, and CDATA comments inside the script. While this technically solves the problem, I still would love to have comments marking my snippets, and, I suppose, CDATA could be important for something as well.

What can be causing it? I do not have many optional modules installed. Main ones content related are the latest 6.x version of i18n (which is my main suspect, but I do not know how to troubleshoot it, not even sure I can safely turn it off without damaging the translated content), FaceBook integration, and, mayhaps, Devel.

Edit: This occurs with any code (formatted as “full HTML”, at least). HTML comments get printed twice, and if JS code happened to be between those, so would it.


texts: Is there a module that makes Taxonomy tags like they are on stackexchange sites?

texts: I'm Looking for a module that makes my free tagging taxonomy tags like they are on this or any other stack exchange site. I would like for when a user puts their cursor in the Autocomplete tag field, it displays a list of suggested tags for them to select. Also, I would like to incorporate tag aliases/synonyms so multiple tags relate to one another. I'm running Drupal 7 and I figure I could use permissions on my taxonomy set to allow people to create new tags based on their role. Does anyone know of a module or way to get this functionality? Thanks.


texts: Delete unused tables from the drupal database

texts: In my Drupal database I have so many field_deleted_data_XX and field_deleted_revision_XX tables. I have disable the revision entity but I want to delete these existing revision created tables, can I delete these tables directly or Is there any SQL script to delete unused tables from the database.


texts: Add a non-system confirm popup on node add/edit

texts:
I want a custom confirmation popup to come up when someone wants to save a new node or update an existing one. Of course, the form only submits/saves info if the user clicks Yes. As it is now the popup only fires on the first click (of course it should fire as many times as necessary), and the form still submits regardless of whether one clicks Yes or No. It should only submit when the user clicks Yes. If the No button is clicked the popup should disappear and the user can go on working on their node. If they finish working and click Submit again, the confirm popup should reappear and work as expected.

I am using Workflow on my form, and I only want this functionality for certain workflow states (IDs 2 and 5), not all of them. For the JS confirmation popup itself I want to use Vex.

It seems like one needs to do an AJAX callback for this, so here is what I have in my hook_form_alter function. The first part adds the AJAX callback to the submit buttons, and then the inline JS should call the popup. Lastly, the AJAX callback just returns a string.

What have I done wrong here? I would be thankful for any help.

// The part of my hook_form_alter where I give the submit button AJAX functionality
$form['actions']['submit']['#prefix'] = '';
$form['actions']['submit']['#suffix'] = '';
$form['actions']['submit']['#ajax'] = array(
        'event' => 'mousedown',
        'callback' => 'confirm_save',
        'wrapper' => 'wf-wrapper',
        'prevent' => 'click',
        'method' => 'replace'
);
$form['workflow_button_js'] = array(
        '#markup' => '

',
);

// AJAX callback, just returns a string

function confirm_save($form, &$form_state){
    return 'submit';
}


texts: Scenario for validation in two submit times ( the second one validates and shows a previous hidden field)

texts:
I'm using alter_form to change 'user_login_form'. The problem is that i'm hidding a field and i want to show it to the user and validate it ONLY AFTER login and pass are validated ( user has done a previous click to the 'log in' button )

How can i 'say' to the form that i'm still not finished and need to fill up a 'new field' that now can be showed and validated ?

I'm not sure which is the best approach? Anyone had the same situation before ?


texts:
I have an HTML page (http://localhost:8888/test/test.html) in which I'm trying to pull data from a Drupal 7 website.

I'm using this AJAX code with HTML-Request. I have tried JSON and the website prevents me from pulling, even I have added the following code to pull the data.

<?php header('Access-Control-Allow-Origin: *'); ?>

This is the HTML page that requests AJAX from Drupal 7 website. Could you please check it for me?

Please help me telling the website to accept my localhost request to pull data from the server. I have tested the same code on a pure PHP page and it is working fine.


texts: Referring created users to 'admins' that created them

texts:
I know user can be given a permission to create other users. However, it doesn't seem that user table has any created_by field to store the ID of the creator. Does it?

Is there a way not only to create a field like that (could do it through profiles management) but also to actually put creators ID in it with just using drupal base config or some module?

I simply need to be able to list users created by a particular 'admin'


texts:
I have used the Workbench module in my Drupal 7 website.

Now I want to migrate this website to Drupal 8. But when I migrate the site, it migrates only content and not the workbench states that were created for contents.

Any help?


texts: Statistic count not working with API call

texts:
There isn't much info around it, but when I'm using Statistic module to get the views per node it's only working when I'm visiting the page of the specific node. When I'm using an API call to a specific node, the statistic module doesn't increase with 1...

Is there a way to solve this?


texts: Problem with photo on anonymous user page

texts:
I uploaded an article with a photo to my website. The photo is showing for administrators, but not for anonymous users.

What do I need to do to make sure the photo displays for all users?


texts: How can add Thumbnail image in Drupal 7 site?

texts: I have set an image style as a thumbnail, but it doesn't render as my thumbnail style.  Instead, it is showing the original size of image.  How can I solve this problem.


texts: Adding variation types and sub variation types

texts: I'm new to commerce kickstart and am wondering how I can create variation types and "sub" variation types? I would like to create an architecture that allows me to have a variation type fruits and then sub types apples and oranges e.g. - how can I do this?


texts:
Is Drupal is ready for GDPR compliance?

Is there any patch or extension they need to apply for GDPR ready for all EU countries as this is the law for EU countries the come in effect on may 25, 2018.


texts: Custom ajax widget can't save generated value to database - $item always zero

texts:
I'm currently working on a custom module that communicates with a REST API. It is implemented as a new field type with a custom widget. The entire communication with the API works fine. The thing is that I'd like to save one part of the response in the database and I can't get it to work.

My code is here:
https://github.com/stopopol/b2share/blob/master/b2share.module

Basically, I only need the information of one textfield ( $form['b2share_fieldset']['pid_button']) to be saved in the database, but the save function doesn't seem to be called.

I tried following this tutorial: http://getlevelten.com/blog/ian-whitcomb/defining-custom-field-types-drupal
but I had no success yet.
Maybe it's also important to mention that this field will be embedded in a content type together with plenty of other fields, therefore the communication with the rest api is done via ajax, but the values I get from the API should be stored together with the regular fields in the node form.

I only need someone to tell me what's missing from being able to save it. I've been stuck for days and can't figure it out.

Thanks.

EDIT: Ok. I narrowed it down and it seems like the problem is that

foreach ($items as $delta => $item)

never runs because the size of $items is always 0. I haven't found the reason yet. But will post my insights here.

EDIT2: Thanks for the helpful comments. I used hook_submit and was able to save values in the database, but drupal is complaining about the entity_Id and delta.

Example code I found suggests a function like this:

 function b2share_form_alter(&$form, &$form_state, $form_id) {
   $form['actions']['submit']['#submit'] = array('b2share_form_submit');
   return $form;
 }

 function b2share_form_submit($form, &$form_state) {
 drupal_set_message( 'submit handler is called' );

 $values = array(
   'url' => $form_state['values']['b2share_fieldset']['url'],
   'pid' => $form_state['values']['b2share_fieldset']['pid']
 );

 $insert = db_insert('field_data_field_b2share')
   -> fields(array(
    'field_b2share_url' => $values['url'],
    'field_b2share_pid' => $values['pid'],
    //'entity_id' => 1,
    //'delta' => 0,
    //'language' => 'und',
))
->execute();
}

But apparently the functions needs to give more info or I am missing something somewhere else.

EDIT 3: Calling b2share_form_submit breaks the node form. The error message says: "The requested page "/.../node//current-revision" could not be found."

Logs say :

"Warning: Missing argument 3 for b2share_form_submit(),"

"Warning: Missing argument 4 for b2share_form_submit()"

EDIT 4: As described here in a comment (Do something after submit the form at hook_form_alter) this is the correct way to write the form_alter function:
function b2share_form_alter(&$form, &$form_state, $form_id) {
  $form['#submit'][]='b2share_form_submit';
  return $form;
}


texts: How to Filter view by comparing 2 fields. If field-a < field-b

texts:
I have a product content type that has 2 price fields.

I want to create a view that shows all products where price-A is less than price-B.

I was hoping I could just add a filter and select price-A then choose operate less than and set the value as price-B, however you can't do that.

I have looked into using a views hook, mainly hook_views_query_alter but haven't had any luck.

I've also tried using the Views PHP module and been unable to get it to work.

Does anyone know the best way to achieve this?


texts: Create content type with fields that are content types

texts:
I am trying to do something similar to this

I have a catalog content type.  I want to be able to add one or more books related to the catalog topic to this content type. These books would be of a custom content type. Each book would only be tied to a single catalog but a catalog may have many books.

I want to create a page for each catalog topic that has the fields of the catalog content type (like description etc) and then a list of all the books related to the catalog topic.

I want authenticated users to be able to add new books ("add book" link) to the catalog and also to be able to create new catalogs for the topics they choose. When a new catalog is created, it should have an "add book" link.

How would do this?


texts: Non-static method view::load_views() should not be called statically with VIEWS

texts:
When I copied my Drupal 6 web site to another server with a higher version ofPHP, I get this problem on all pages that have views:

strict warning: Non-static method view::load_views() should not be called statically in C:\xampp\htdocs\sites\all\modules\views\views.module on line 864.
strict warning: Non-static method view::db_objects() should not be called statically in C:\xampp\htdocs\sites\all\modules\views\includes\view.inc on line 1417.
strict warning: Declaration of calendar_plugin_display_page::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in C:\xampp\htdocs\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 297.
strict warning: Declaration of calendar_plugin_display_page::options() should be compatible with views_object::options() in C:\xampp\htdocs\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 297.
strict warning: Declaration of calendar_plugin_display_block::options() should be compatible with views_object::options() in C:\xampp\htdocs\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 78.
strict warning: Declaration of calendar_plugin_display_attachment::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in C:\xampp\htdocs\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 242.
strict warning: Declaration of calendar_plugin_display_attachment::options() should be compatible with views_object::options() in C:\xampp\htdocs\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 242.
strict warning: Declaration of calendar_plugin_display_ical::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in C:\xampp\htdocs\sites\all\modules\calendar\calendar_ical\calendar_plugin_display_ical.inc on line 217.
strict warning: Declaration of views_content_plugin_display_panel_pane::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in C:\xampp\htdocs\sites\all\modules\ctools\views_content\plugins\views\views_content_plugin_display_panel_pane.inc on line 40


texts:
I am trying to add a form when I view my node; for that I am using the following code.

function review_m_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
    switch($op){
        case view:

In this case I would like to call drupal_get_form().

I would like to add the following code.

function review_m_form($node) {
    $form = array();
    $form['mark'] = array(
        '#type' => 'textfield',
        '#title' => 'Give a mark to the content type(1 to 10)!',
        '#size' => 60,
        '#maxlength' => 2,
    );
    $form['text'] = array(
        '#type' => 'textarea',
        '#title' => 'leave a feedback!',
        '#cols' => 60,
        '#resizable' => FALSE,
        '#rows' => 5,
    );
    $form['created'] = array(
        '#type' => 'textfield',
        '#title' => 'Enter the date!',
        '#size' => 60,
        '#maxlength' => 10,
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Send review'),
        '#weight' => 10,
    );
    return $form;
}

How can I pass this in the view case, so that it works good for me?

I am trying something like the following code.

case view:
            $node->content['form'] = array(
                drupal_get_form('review_m_form'),
              );


texts: How to Include an ATTACHMENT to a Drupal's Entityform Submission Email?

texts:
I am using the Entityform module and the Rules module for its notification .
I noticed that the email sent out when the form is submitted does not attach the PDF file as part of the email's body.

I have one field in the form that allows a user to attach a PDF file.
The email body is fine with the exception that any file attachment is not part of the email.

I also added the Mime Mail module with no success.

Does anyone know how to include an attached file as part of the email notification?


texts:
I'm trying to restrict the comment permissions as follows:

Any user can view own comments and any reply to his comments on a node.
Node Author can view all comments on his node.

Is it possible to achieve this using Views?
Update:
I'm considering doing this with Entityform module as it seems to do what I want out of box.


texts: Drupal Forms API how to get degree sign onto submit button

texts:
I'd like to have a submit button with "°C" value on it. But when I just copy paste the degree sign, I get an empty value. When I try HTML code for degree sign (&deg;) it is escaped so I get &deg;C.

This is my submit button element in my hook_form function:

$form['wrapper']['F'] = array(
    '#type' => 'submit',
    '#name' => 'F',
    '#value' => '°F',
    //'#value' => '&#176; F',
    //'#value' => '&#x00B0; F',
    '#attributes' => array('id' => 'fahrenheit-button'),
    '#weight' => 20,
  );

Any ideas? Thanks, Tomas


texts: How can I get entity / entity id from current route in a test?

texts:
I'm writing a test using Drupal\Tests\BrowserTestBase

I try create a node by posting it to the node add form, after I will be redirected to the view page of the new node. Now I want to save the node or the node ID so I can continue to run tests on this node - how can I do that?

I tried to make a function like this:

  public function getEntityFromCurrentPage() {
    foreach (\Drupal::routeMatch()->getParameters() as $param) {
      if ($param instanceof EntityInterface) {
        return $param;
      }
    }
    return NULL;
  }

But it only returns NULL


texts: Pre-populate an entity reference field (media image) when creating a node

texts:
I am trying to open a node creation form (for example, /node/add/article) and to have an Entity Reference field pre-populated.

My field (field_image) is an Entity Reference to a Media of type Image and the form uses the Media Library widget.

I essentially tried doing that by implementing hook_form_alter in a custom module but nothing that I have tried worked. I saw solutions like this one. It works with other field types that I have tried. For example:

// Pre-populate Entity Reference field to taxonomy term

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(13);
$form['field_category']['widget'][0]['target_id']['#default_value'] = $term;

The above works just fine. But the below doesn't.

// Pre-populate Entity Reference field to Media Image

$media = \Drupal::entityTypeManager()->getStorage('media')->load(38);
$form['field_image']['widget'][0]['target_id']['#default_value'] = $media;

I also tried by providing just the media id instead of the entity but it didn't work.

I have tried the Prepopulate module too but couldn't get it to work either although it works with all other field types that I have tried.

Anyone knows if this is feasible and how?

Edit: I should perhaps mention that I am not looking for a solution on how to set a default value for that field. The referenced entity must be set dynamically

For reference, here is my complete code:

/**
 * Implements hook_form_alter().
 */
function siteconfig_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  if ($form_id == 'node_article_form') {

    // This works
    $term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(13);
    $form['field_category']['widget'][0]['target_id']['#default_value'] = $term;

    // This doesn't work
    $media = \Drupal::entityTypeManager()->getStorage('media')->load(38);
    $form['field_image']['widget'][0]['target_id']['#default_value'] = $media;
  }
}


texts: Display Auto Generated Youtube Thumbnails with 'Video Embed Field' Module in Views

texts:
I added some videos to my site and I'm using views to display them. I followed a tutorial and i used the rewrite the output option of the view with allowed replacement patterns to display videos in lightbox in this way.

Here when i clicked on the a image, the video will played in the lightbox and that was great.
In the above link added a custom the image field as thumbnail but that doesn't work well, because when i add more than one video all will have the same thumbnail.

But then i also came to know, that the Video Embed Module when used to add videos, auto generates the thumbails of the added youtube videos in a public directory. So again i worked on the replacement patterns and got the raw thumbnail field generated by the Video Embed Module.

Again i rewrote the output with the raw thumbnail as image

But the thumbnail image is broken and the image path is shown as
public://video_embed_field_thumbnails/youtube/RQieoqCLWDo.jpg which i guess is not recognized by drupal.

So my point here is, Is there a way to access the raw thumbnail in the rewrite patterns so that every youtube video gets its own thumbnail without manually adding image as thumbnail.


texts:
I am not clear after reading another question on same topic how this is done.

At the moment I go to my root drupal install and drushup then updatedb so if I then go
to the folder of a multisite and try to drushup it says nothing to update.

If all the modules are in the root drupal install is that sufficient? Could you not make sure they are all placed in there so you would need to only drushup the root folder?

How then do you update individual databases?


texts: How to I programatically search for a specific entityform submission?

texts:
I want to search for submissions where a field has a specific value.

$query = new EntityFieldQuery();
$formentities = $query->entityCondition('entity_type', 'entityform')
  ->entityCondition('type', 'selection_form')
  ->fieldCondition('field_session', 'value', $session_id, '=' )
  ->range(0,1)
  ->execute();

Can't quite get the code correct.  Can you help?  I think this might be looking for the form, rather than submissions......


texts:
For a section of our site, we need to show fields, even if they are empty. A helpful suggestion has been to edit content-field.tpl.php and remove the following part.

<?php if (!$field_empty) : ?>
<?php endif; ?>

But I don't want all empty fields to show up; only a handful that are under a Field Group in my custom content type should be shown.

I'm looking for a way of saying, "Show all fields under group X in content type Y."

Does such a thing exist?


texts: Which view do I have to use to make the order of the images random in Node Gallery Slideshow?

texts:
I'm currently using Node Gallery Slideshow module for displaying a gallery with a slideshow. It works correctly, but when displaying the images, the order of them is sequential, and I haven't found a way to make it random - at least on the admin interface...
So which view do I have to use to get a random order.

Thanks!


texts: How to sort translation under Translate tab?

texts: I need to sort these translated language names alphabetically. I want to sort these irrespective of these languages weight and hierarchy. How can I do that?


texts:
I am trying to minimize my workload in the future by putting recycled content into tokens, so that I only have to update the token as opposed to updating each individual node that uses the same content. I have little experience with tokens, so my question is very basic.

Example of what I want.. say I have the following on dozens of different nodes:

Item 1: $29.99

Rather than having to update each node when 'Item 1' gets a price change, I'd rather have each node just using a token for 'Item 1', so that I only have to update the token instead of all the nodes. I've installed the Custom Tokens module, but don't understand how to display my custom token in the node's content body. If I set the custom token name as "token-1", how would I display the token in the actual content? ie. [token-1], [custom:token-1] etc don't work.

Any help would be greatly appreciated!


texts: How to creating custom links that can be echo'ed individually

texts:
Let's assume I have a footer with this div for which I have created a custom block named as custom_footer:

{% if page.custom_footer %}

{% endif %}

Now, I would like to put links inside the footer that are created using Home  > Administration > Structure > Menus > Add menu in other words I don't want to insert hard-coded menus like services  inside the footer div.

So, is there anyway to echo all the custom links for page created inside my footer?


texts: How to inherit 'Date' element in webforms?

texts:
I tried to simply extend the Date element in webforms like this

/**
 * Provides a 'birthday' element.
 *
 * @WebformElement(
 *   id = "birthday",
 *   label = @Translation("Birthday"),
 *   description = @Translation("Provides a custom form element for birthday date selection."),
 *   category = @Translation("Date/time elements"),
 * )
 */
class BirthdayElement extends Date {}

and I see and can select it in the build options. However when I click on the Test tab, I only see the Label and no date input field. What am I missing?


texts: Is there any way not to use the Drupal Image-style system?

texts: I upload mainly light images (around 40 kb's) to my site and also want to save room on my server and don't use 4 different folders for images --- is there any way to avoid using the Drupal image styles system? Can I safely remove the image style folders (or most of their files) and that's it? --- I will check all site pages afterwards and re add images if needed, I just don't have many pages (I have about 30). Thx.


texts: theme_preprocess_node not working inside of a view

texts:
I'm trying to add a variable to the $classes array on a node, but it's not adding it while the node is in a view.

function MY_MODULE_preprocess_node(&$vars, $hook) {
  // Add the terms to the body classes for my_node_type'.

  if ($node = menu_get_object()) {
    if ($node->type == 'my_node_type') {

  // Return an array of taxonomy term ID's.
  $termids = field_get_items('node', $node, 'my_field_name');

  // Load all the terms to get the name and vocab.
  foreach ($termids as $termid) {
    $terms[] = taxonomy_term_load($termid['tid']);
  }

  // Assign the taxonomy values.
  foreach ($terms as $term) {
    $class = strtolower(drupal_clean_css_identifier($term->name));
    $vocabulary = drupal_clean_css_identifier($term->vocabulary_machine_name);
    $vars['classes_array'][] = $class;
   }
  }
 }
}

I added a

<?php dpm($classes); ?>

on my node.tpl.php I'm able to see the particular field being added to the classes array in my <div class="my_field_name">. But when it's in a view, the class isn't applied which makes me think that the preprocess_node isn't being called properly. Any suggestions for what I should do or anything I'm missing that's preventing the hook_preprocess_node from being called properly? I've tried placing it into my theme's template.php instead of in the custom module I'm using but neither work.

ANSWER NINJA EDIT (can't post one for another 8 hours)

I was able to finally get it to call the classes properly. Appears that these conditions were not being met in the view:

if ($node = menu_get_object()) {
    if ($node->type == 'my_node_type') {

so I removed that line and instead replaced it with

$node = $vars['node'];

Removed the code from my custom module and placed it in my custom theme's template.php o the function now looks like this

function MY_THEME_preprocess_node(&$vars, $hook) {
  // Add the terms to the body classes for MY_NODE_TYPE'.
  $node = $vars['node'];

  // Return an array of taxonomy term ID's.
  $termids = field_get_items('node', $node, 'MY_FIELD_NAME');

  // Load all the terms to get the name and vocab.
  foreach ($termids as $termid) {
    $terms[] = taxonomy_term_load($termid['tid']);
  }

  // Assign the taxonomy values.
  foreach ($terms as $term) {
    $class = strtolower(drupal_clean_css_identifier($term->name));
    $vocabulary = drupal_clean_css_identifier($term->vocabulary_machine_name);
    $vars['classes_array'][] = $class;
 }
}


texts: How to get value from URL in a view block using contextual filter?

texts: I want to show related nodes of an open article in a block, but how do I access Node IDs from url in block view.


texts: Renaming the field label from "author" to "created by"

texts: How can I implement a hook in my template file that will change the label of a field for the "group" content type from "author" to "created by"?


texts: add user profiles fields into comment fields

texts:
I'd like when a user comments, to display his information.

Let's assume I do have in my user profile 2 fields, Job title and Biography.

When a user comments, I would like to get those 2 fields and display them as comment fields.(same for existing comments)
It will then display the comment + job title + bio

What the best solution for that ?

I was thinking about a preprocess to load the $user but maybe there is some configuration which could do it instead.
In this example I added 2 fields in the comment section of my content type then I'm trying to get the user profile infos to the current fields.

function template_preprocess_comment(&$vars) {
      if($vars['comment']->uid !== 0){
        $user = user_load($vars['comment']->uid);
        $vars['field_job_title'] = $user->field_job_title;
        $vars['field_bio'] = $user->field_bio;
      }
}

Final approach was:
For the existing one that what I came out with:

function hook_user_presave(&$edit, $account, $category){
    //get all node we need
    $results = db_select('node', 'n')
                  ->fields('n', array('nid'))
                  ->condition('type', 'my_content_type', 'LIKE')
                  ->execute();

    foreach ($results as $result) {
        $nids[] = $result->nid;
    }
    foreach ($nids as $key => $nid) {
        //get all comment ids
        $result = db_select('comment')
            ->fields('comment', array('cid'))
            ->condition('nid', $nid, '=')
            ->condition('uid', $account->uid, '=')
            ->execute();

        $cids = $result->fetchCol();
        $comments=comment_load_multiple($cids);
        foreach($comments as $comment) {
            //load comment
            // $user = user_load($comment->uid);
            if(isset($edit['field_job_title']) && isset($edit['field_bio']) && $account->uid !== 0){
                //change data of the comment
                $comment->field_job_title = $edit['field_job_title'];
                $comment->field_bio = $edit['field_bio'];
                //save it
                comment_save($comment);
            }
        }
    }
}

function hook_comment_presave($comment) {
    //if not user, otherwise it does it when you do the comment_save($comment) from the user_presave, then it won't work
    if(arg(0) !== 'user'){
        $user = user_load($comment->uid);
        if($user->uid != 0){
            $comment->field_job_title = isset($user->field_job_title) ? $user->field_job_title : NULL;
            $comment->field_bio = isset($user->field_bio) ? $user->field_bio : NULL;
        }
    }
}

and this one to hide the current fields when you comment:

function template_form_comment_form_alter(&$form, &$form_state) {
    $form['field_bio']['#access'] = FALSE;
    $form['field_job_title']['#access'] = FALSE;
}


texts: How to hook payment created on commerce 2

texts:
I use commerce to create a bakery. Unfortunately, there is no module to pay by check or cash. So I use the payment example "manual".
I need to debit the user account when a payment is entered (a "balance" field has been created on the user account).
Is there a hook when a payment is created so that I can do this operation on the user entity?


texts: hierarchical select based in taxonomy for webform

texts:
I have used the Simple hierarchical select and hierarchical select module long time ago, but now I need that functionality for a webform, I have a list of taxonomy terms with all the states and cities of my country organized

I know that with webform conditionals I can create each condition separately but that would be very tedius, is there a way of create the hierarchical select functionality based on my taxonomy terms for my webforms?


texts:
How can I perform a redirect after purchasing a product? I tried to create a custom checkout pane for this purpose, but it doesn't work as the form is not submited:

public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
  if ($this->getStepId() == 'complete') {
    $form_state->setRedirect('<front>');
  }
}

Is there any possibility to do this with a pane or do I have to create an event subscriber and redirect on the checkout event?


texts: How programmatically create custom field type with some base fields?

texts:
I want to emphasise that I don't want to use field_collection.

I want to create custom field type that can be reused in different entities and bundles. This should be kept in one custom module. So when I enable it and go to 'manage fields' page on any entity type then I should be able to pick up my custom field type (e.g.: foo). This field should be combined with base image field and simple one line text field. I don't want to use field_collection module because as far as I see I can not recreate my field, even features give me ability to export it in field_base section. After flushing my drupal to clean instance and enabling this feature again I can not see it in 'Add existing field' in [structure > content types > CONTENT_TYPE > manage fields] page. Maybe I'm doing something wrong. (?)

So how can I programmatically create custom field type with existing base fields? e.g. Custom foo field type with image field and text field?

OR (if I done something wrong with features..)

How can I export custom field collection with sub fields, only as a field definition (not attached to any content type/entity) using features?


texts: How to send email to submitter in a webform?

texts:
I have a webform and i want to send by mail this webform to submitter.
For the moment, i created an hidden field with token [current-user:mail] and i chose this field in adress.
I think it isn't very well. Can I do it in hook_form_alter ? if yes, how to do it?


texts:
I'm having problem with a site installed with Acquia Dev Desktop, but I can't find the php_error.log file to see the errors. There is nothing inside the DevDesktop folder and I can't see anything in the Software Preference.

Where is the php_error.log file in Acquia Dev Desktop?


texts: How to redirect a user to a visited sub-domain on his next visit to main domain

texts:
I have a website say example.com with 5 sub-domains: site1.example.com, site2.example.com, site3.example.com, site4.example.com, and site5.example.com.

When users visit example.com, they are presented with the other 5 sub-domains to choose from. I want to implement something that redirect the users to the sub-domain they choose the first time they visit the main domain. I know I can use cookies for this, but how can I implement this in Drupal?


texts: How to hide an image field from teaser view if video field has data?

texts:
foreach($view->result as $value){
     if($value->_entity->field_videos->getValue()[0]['target_id']){
      kint($value->_entity->field_blogimage)
    }

I am getting following image by kint, I need to set exclude to 0 for image field of this view in views_pre_render hook in drupal 8.


texts: field is Integer and I am getting PDOException error thrown

texts:
I have a field called "blog_post_guid" and it is set as Integer.

Recently, it is throwing this error:

  PDOException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of
  range value for column 'blog_post_guid_value' at row 1: INSERT INTO
  {field_data_blog_post_guid} (entity_type, entity_id, revision_id,
  bundle, delta, language, blog_post_guid_value)

Running a search revealed this article.

Based on this information I thought I should install and enable BigInt.

Is there any other relevant solution to this issue for Integer field and Drupal 7?


texts: Can i know from where drupal core render comment_form Actually what i mean is what is the location of file which bear comment_form ..In my d7 folder , i am now testing it on localhost win7.I want to know it so that i can easily do change in comment form texts, do change in comment buttons, is this possible?


texts: How to resolve the 403 error when creating a new node via RESTful module?

texts:
I'm trying to create a new node through REST on Drupal 8 with no success and a 403 (Forbidden) error. I'm using REST UI module to enable permissions with the following config for Content resources:

  GET authentication: basic_auth formats: hal_json, json

  POST authentication: basic_auth formats: hal_json, json

After many failed tries I installed a fresh copy of Drupal 8.2.3 to discard it had to be with the recent core upgrade on my original site. The big surprise is on the fresh site there are no other RESTful module permissions than Administer REST resource configuration, no permissions to grant DELETE, GET, PATCH or POST to each role.

I'm using Postman for testing purposes as follows:

Request body:

{
    "_links": {
        "type": {
            "href": "http://fischer.dev:81/rest/type/node/article"
        }
    },
    "title": [
        {
            "value":"My article"
        }
    ],
    "type": [
        {
            "target_id":"article"
        }
    ]
}

User role is granted permissions to create Article nodes. I tried even with the admin credentials with no success. The GET method for retrieving an existing node is woking fine.

I don't know if there was any change on the latest Drupal release since the official documentation page for this module appears to be outdated. Am I missing something?


texts: Implement Menu block hook function hook_menu_block_tree_alter() to add/change/remove classes

texts:
I have installed the plugin Menu block and I am very happy with the result, but I'd like to change some classes in the structure.

This is what I get right now:

            News

                    Test

..and this is what I want:

            News

                    Test

So I basically want to..

..add/change/remove the
's class and id attributes (level specific, so not the same for the primary/secondary
).
..add a has-submenu class to an
 if it contains another submenu.

What I've tried:

As explained in Menu Block's documentation, a hook function hook_menu_block_tree_alter() can be implemented. To start 'somewhere, I tried implementing this in template.php without any success (but doesn't even get called):

function THEME_menu_block_tree_alter(&$tree, &$config) {
  foreach ($tree as $key => &$value) {
    if ($tree[$key]['link']['access'] && !$tree[$key]['link']['hidden']) {
      $items[] = $tree[$key];
    }
  }

  $num_items = count($items);
  foreach ($items as $i => &$data) {
    $class = array();

    if ($data['link']['has_children']) {
      $class[] = 'has-submenu';
    }
    $element['#attributes']['class'] = $class;
  }
}

Any help would be much appreciated as I don't really have deep understanding of how and where to implement this hook function. Also my impression is, that some more detailed documentation is missing for this specific hook function..


texts: Rewriting taxonomy term in exposed filter

texts:
I have an exposed taxonomy term filter with values of "true" and "false".  I would like to simply rename the options to "yes" and "no".

I can't simply change the taxonomy tern name since I am importing the values from a XML file.

How would you suggest I do this?
Is there a simple CSS rewrite - changing true to yes, and false to no?
Is there a field theme function I should use?

Thanks for any help.


texts: How to sort only own webform submissions in a view?

texts:
I have a view that lists all users webform submissions.

I want to be able to have the view show the name of the user instead of his id and display only his own webform submissions.

Image-1


texts:
I am new to drupal. I need to develop a corporate intranet portal using drupal 7.
I have features like,

Employee profile creation

Announcement (Internal announcement, internal opportunities, display
new joiners with their      photo and info)

Employee birthday celebration

Awards

Discussion board

Survey

LMS

Event calendar
and many more.

I would like to know whether corporate portal can be built with drupal.
Please let me know if there any modules for the above requirement or any opensource for this .
Thanks.


texts: Add views (sum of a number field) into computed field

texts:
I have three field in a content type, date and category and amount.
Based on amount field, I created a views to get total amount (aggregator views) by category as argument.
So in this content type I want to add a computed field, which will give me cumulative total (sum of all previous amount (+) current amount, current node category as criteria).
Is is possible by adding a views inside computed field of drupal 8, or any other way (rules/sql of drupal 8) to achieve it. I am new to drupal, looking for solution for my project.
Please help me to get it done by providing ideas, codes or reference, I am not coder, I just trying to learn it!


texts: Menu link that is author nodeid specific

texts:
When a user creates an account i have a rule that creates a node and set them as author for it.

I need a user specific link in the menu that varries from user to user.

User 1 may need the link: "Edit your node" -> Links to node/1/edit
User 2 may need the link: "Edit your node" -> Links to node/5/edit

So its something like:

If content type = FOO, and node author = logged in user, show link "Edit your node" that links to -> node/%/edit.


texts:
Im making an exportation process (from SQL Server to MySql) and in the text_format column insert NULL values, currently the page is rendering the pure html (plain text) instead of render the html correctly in the browser.

Somebody know how to force the output text_format to be filtered_html to my specific content type?

Thanks in advance


texts: How do I debug Commerce Order Comments token not expanding in Message?

texts:
Using Kickstart 2 with Commerce Message.

The token [message:message-commerce-order:field_order_comments] has begun to -sometimes- not expand. ie. sometimes it render as expected, but sometimes not. And when it doesn't there isn't an error in the error_log.

I've read that with some tokens one changes the underscores to dashes. ie.

[message:message-commerce-order:field-order-comments]

...I tried that and again, sometimes it works and sometimes not.

I have run into this problem time and time again with certain tokens in that they simply don't appear in hook_tokens() when I think they should 'fire'.

In this case, I worked around it by using the exact same code in hook_message_presave() and it works fine.

$message->arguments['!order-comments'] = array(
    'callback' => 'commerce_message_order_comments',
    'pass message' => TRUE,
  );

So I know the token -should- work. I really want to understand the mechanism so I can use these in the future.

So... How do I troubleshoot this? What am I missing?


texts: How to show/hide a link based on a permission?

texts: I'm looking for a way to hide/show a link from the main-menu if the current user has a specific permission. The menu item has already been created and the menu item links to a node that is controlled by hook_node_access().


texts: How to do core development with composer-based install?

texts:
I'm using drupal-composer/drupal-project.

With that, installer-paths in composer.json installs core in web/core, it doesn't clone a full git repository.

I'd like a full repository, so I can reroll a patch for core on my dev site, within the project it will be used on, without having to clone https://git.drupal.org/project/drupal.git and configure an entirely new project…

Is this even possible?

i.e. a modification to composer.json that will install core (or anything else for that matter) as a fully functional repository (i.e. with .git directories) - so you can create new branches, run diffs against to generate patches, and so on.


texts: Render Teaser Image in search block using Twig

texts:
I am trying to render the teaser image in my search block using twig. For my views page for rending the articles i am using this:

    {% block teaser_img_container %}
        {{ content.field_teaser_media }}
    {% endblock %}

And it works very nice but on search block it does not display the image, so I am trying other options like

  <picture>

   {% block teaser_img_container %}

 {% endblock %}

     </picture>

Which should solve my problem, but i still don't see the image i am getting no errors, if i go in my page source the link to image appears but when i inspect the code from I get

The link works, but it does not display my image.
Any ideas for fix?


texts: Module to Create Historic Timeline Snapshots of Drupal Sites?

texts:
I'm looking for a module to create a functionality where it will take snapshots of the entire site and then replicate it to another domain/sub-domain every X number of days or weeks. I want to do this so I can go visit a previous version of the site in the past to see what was changed. I know you can do this with the module "demo", but that just takes a snapshot of the DB and you would have to revert back to that time overwriting what you currently have. Yes I can create a staging server for this, but I want to be able to have it done automatically where I have the following sub-domains where i can go back to:

1day-ago.foo.com
2day-ago.foo.com
1week-ago.foo.com
1month-ago.foo.com
2month-ago.foo.com
3month-ago.foo.com

How would this be done? Or is there a module for something like this?


texts: How to apply theme to Drupal view or block

texts:
I have created 1 view for displaying Category on home page using Ubercart module.

but i want to apply custom css  changes to my Category view fields like image and title

can any knows how to apply css change to DRUPAL views.

Thanks in advance.


texts: Associating a timer on flag click on individual nodes for individual users

texts:
I have a custom field "Time to Finish" in my custom content type in Drupal7. The "Time to Finish" is basically a timer of sorts. whenever the users click a flag (which is placed on nodes of that custom content type) the timer should start. The difficulty associated with this is that:

  Every node of that content type has different Time to Finish
  The timer should start on flag click (the flag is same on all node, "Start Flag")
  Every user would have their own timer then depending on when they click on the Start Flag

The admin while creating the content should have the option to fill in the field "Time to Finish" and on flag click the timer should start. Any suggestions. Would really appreciate it.

Thanks

Edit: I found this module which solves half of my issue,i.e, to assign every individual node their own Time To Finish field. Countdown Timer Field helped with this. Now i need that on "START FLAG" click the timer should start, not before that.

EDIT 2: i have opened a feature request issue for this at http://drupal.org/node/1948958 but can anyone help me do this. It will not only solve my use case but i think is a necessary feature to be added

EDIT 3: if there is any other solution i am eager to hear it as well.


texts: the WYSIWYG editor doesn't show up, drupal 7

texts:
I installed the CKEditor in Drupal 7, following the steps in the documentation. I set up the right permissions and the text options and I cleared the caches, but when I want to add or edit some content, I have only the plain textarea.

However, when I navigate to Administration » Configuration » Content authoring » CKEditor. and edit the Filtered and Full HTML, the WYSIWYG editor shows up as it should when I expand the Editor Appearence tab, so I assume it's well installed.

What I find peculiar is that when I navigate to Administration » Structure » Content types, select a content type and click manage fields and edit for the body field
the area just below the text: "The default value for this field, used when creating new content." is still the old textarea. I don't find any option to change it, as if the WYSYWYG editor wouldn't exist.

Anyone has an idea, a solution? Is it something I miss here?
Thanks a lot for your help.


texts: Drupal Commerce - only show VAT on checkout

texts:
I am fairly new to Drupal, and I am trying to disable VAT on the products view page but only show it on the checkout page. How is this done?

If i go to Store -> Configuration -> Product Pricing Rules there is a calculation rule called VAT which set the VAT throughout the site. I am trying to edit the Action 'Calculate taxes for a line item' which is already configured with the parameter 'Line item: [commerce-line-item]'.

I am trying to change the line item to order total (commerce-line-item:order:commerce-order-total:), but it keeps giving me an error of 'Data selector commerce-line-item:order:commerce-order-total: for parameter commerce_line_item is invalid.'

What am i doing wrong? Any help would be greatly appreciated!


texts:
I have installed Commerce Billy module on my website.

Then upon ordering I get this PDF with this layout.

But I want to change the table displayed, because I've created some custom fields in it and I want to display it also in the table.

Any help will be greatly appreciated.