texts: I am creating my own shortcut bar but can't manage the user access

texts:
I am creating a shortcut bar something like below, but unfortuntly it show up despite my wish that I could hide it for anonymous and administrator users/role. I want to display it for editor roles only. How do I achieve this? Thanks

function shortcat_permission() {
  return array(
    'administer shortcat' => array(
      'title' => t('Administer shortcats'),
      'restrict access' => TRUE,
    ),
  );
}

function shortcat_page_alter(&$page) {
       $page['page_top']['#pre_render'][] = 'shortcat_toolbar_pre_render';
   }

function shortcat_renderables() {

  $shortcut_set = array();
  $shortcut_set['my_list'][] = array("#markup" =>"
");
  $shortcut_set['my_list'][] = array("#markup" =>"
".t('Add Content')."
");
  $shortcut_set['my_list'][] = array("#markup" =>"
".t('Find Content')."
");
  $shortcut_set['my_list'][] = array("#markup" =>"
");
  return $shortcut_set;
}

function shortcat_toolbar_pre_render() {
  $links = shortcat_renderables();

  $links['#attached'] = array('css' => array(drupal_get_path('module', 'shortcat') . '/shortcat.css'));
  $links['#prefix'] = '
';
  $links['#suffix'] = '
';

  return $links;
}

I know you can make use of:

global $user;
  if ($user->uid)  {
display it here...
{

but this won't make the user access right accesible in People > Permissions


texts:
I am trying to create a load balanced Drupal installation.  My setup has a shared storage that all the webservers can read write to.  At the moment I’m having trouble setting up the Drupal configuration at {mydomain}/admin/config/media/file-system/ to save our content to the correct file path.

The file path on the operating system that I’m trying to write content to is of the form:

\xx.xx.xx.xx\my\content\folder\

When I place this in the public file path I get the content written to the local path:

D:\myDrupalInstalation{mydomain}\sites\xx.xx.xx.xx\my\content\folder\

However I know the PHP has rights to write modify content on the shared storage because when I try the same path in private file path the content is written to the shared storage:

\xx.xx.xx.xx\my\content\folder\sites{mydomain}\allTheContent\

Which is what we require.

How can I configure the public file path to write to the same location?

P.S.  I think it is something due to the fact that the Drupal config page itself specifies "This directory must be relative to the Drupal installation directory and be accessible over the web." for public path and "* It should be writable by Drupal and not accessible over the web.*" for Private.

Thanks


texts: How to display User Points Top 5 Contributors with the users profile image?

texts: I'm trying to display the user's profile image/avatar next to the userpoints top 5 contributors block. The profile image is a field created from Profiles 2 module - field_profile_image.


texts:
I am trying to execute drush command from my project root directory and i am getting following error

bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See drush topic docs-aliases for
details.
 * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell.


texts:
I have a taxonomy vocabulary with  name "Animals" along with following terms

  Mammals

              Animalia
              Chordata
              Mammalia

                       Bat
                       Bear
                       Fox

I have created a view with contextual filters in which I need to show the hierarchy of the taxonomy terms
For example : URL : base_URL/Mammals/Mammalia/Bat

Taxonomy Implementation that I have made :

Added relationship of taxonomy terms on node
Added relationship of parent term
Added contextual filters for parent term.
Added contextual filters for taxonomy term id with depth.
(Please find the settings of the same in attached screenshot).

But actual results I'm getting is "base_URL/tid" but expected URL result what I need is "base_URL/Mammals/Mammalia/Bat".

Can anyone please help me out with detailed implementation?


texts: How to make a form that captures a value from $_REQUEST[]

texts:
Update: This question now has a clone: https://stackoverflow.com/questions/13184335/drupal-how-to-make-a-form-that-captures-a-value-from-request

I have been trying to make a form that captures a value passed in from $_REQUEST.

A field is displayed only if a $_REQUEST variable exists (done)
The user can modify the field
The field is validated in whatever way
The (modified) value gets used

In this specific case, I am using a hook_user function, but I hope that the solution is applicable to any Drupal form.

Here's a simplified version of my code where the user would have an extra field to specify that they have a favorite fruit if they were to register using the following URL:

http://example.com/user/register?fruit=pineapple

function fruity_user($op, &$edit, &$user, $category = NULL){
    switch($op) {
        // Add extra fields if $_REQUEST contains values for them
        case 'register':
            if($_REQUEST['fruit'] == 'pineapple'){
                $fields['user_reg_info']['profile_fruit'] = array(
                     '#type' => 'textfield'
                    ,'#description' => 'Your favorite fruit (if applicable)'
                    ,'#locked' => 0
                    ,'#value' => $_REQUEST['fruit']
                );
            }
            return $fields;
            break;

        // check registration for mistakes
        case 'validate':
            if ($edit['form_id'] == 'user_register') {
                if ($edit['profile_fruit']){
                    verify_fruit($edit['profile_fruit']);
                }
            }
            break;

        // runs after the new user is inserted
        case 'insert':
            if($_REQUEST['fruit']){
                db_query('INSERT INTO user_fruits SET `uid`=%d `fruit`="%s"',array($user->uid, $edit['profile_fruit']));
            }

            // record information
            watchdog('user', t('user %user picked out a fruit',array('%user' => $user->name)));
            break;
    }
}

With the above code, the field does make itself visible only when $_REQUEST['fruit']  is present but if you change your fruit to "watermelon" on the form, insert still uses "pineapple".


texts:
I have a module that create custom PDF with multiple selected nodes and I use the below function to create the link to styled images:

$file = File::load($img_id);
$imagesPath[] = ImageStyle::load('550x300')->buildUrl($file->uri->value);

Unfortunately, the image itself is not created, only the link, which is ok if I display it on a simple webpage because Drupal will create it on the fly when needed but on a PDF it cause errors because the image it not found before the PDF could be displayed.

Is there a programmatically way to create this image ?

Thanks.


texts: Migrating into a multi-value nested custom field

texts:
I have a nested field called released with three values

By
When

A node can have multiple releases. However, in the old dataset (d7), each node only had one release and the fields just a part of the node.

I want to now migrate it to the new format in d8

If it was just one value, I could do this

released/by: field_released_by
released/when: field_released_at

I tried the solution at https://www.freelock.com/blog/john-locke/2017-12/slick-migration-trick-convert-columns-multi-value-field-subfields which didn't help. It tried to look up the dummy fields and caused it to fail.

I can't be the first person to come across this requirement so I am loathe to write a process plugin for it.

Is there a straightforward solution for this? or is a process plugin the only way?


texts:
I'm using the Meta Tags module to pretty up my page titles using tokens.  I want to display the taxonomy term parents in the page title, with separators.  It's working, except I need it to also END with a separator.  Though if no parent exists, I don't want the separator, obviously.

What I have so far:

[term:parents:join:&nbsp;-&nbsp;][term:name] | [site:name]

But I want a dash (or pipe, or something besides a space) right before the term:name token for when there is a parent.  But this:

[term:parents:join:&nbsp;-&nbsp;] - [term:name] | [site:name]

Results in all page titles without parents to start with the dash.  Any ideas?


texts: how to exclude specific link or logged in users from being cached in memcache?

texts:
I am using memcache 1.1.2.3.  when the editors try to create new article they face a problem with uploading images. image upload got broken in the middle of the uploading process. IMCE and imagemanager do not have any problem. i think te problem is with memcache.
how can i exclude logged-in users from being cached in memcache, or how can i tell memcache to exclude some pages (like the link that create new article')?
Thank you


texts:
Why does this work in Twig:

{{ content.field_image.0 }}

but this does not?

{% for item in content.field_gallery|slice(0, 1) %}
<div>{{ item }}</div>
{% endfor %}


texts: How to make Paragraph label configurable

texts:
Drupal version 8.4.4

I have a paragraph type defined (For example Links), which only has one field of type link.

And I have Entity reference revisions field in my node edit form.

When I view the node i see the referenced field Label, How to make this label configurable?


texts:
I am trying to change my Drupal 8 theme user edit form but can't find a template to override. I want't to make something like this: http://keenthemes.com/preview/metronic/theme/admin_1/page_user_profile_1_account.html

Is it possible? Thank you!


texts: Why would a field be missing from the Rules data selector?

texts:
I've added a couple of fields to the standard product bundle included with Commerce, like so:

I'm now trying to add a rule (Data Comparison) based on the "Special Offer Active" field, but for some reason it's missing from the data selector:

The other field I've added ("Special Price") shows up fine.

Anyone know why this might be happening? I've cleared caches a few times and run cron to no avail.


texts: AJAX form blocks getting internal server error

texts:
I am trying to add a subscribe button as a block.

I added a form as

class SubscribeTag extends FormBase {

  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['actions'] = [
      '#type' => 'actions',
    ];

    $form['actions']['ajaxsubmit'] = [
      '#type' => 'submit',
      '#value' => 'Subsscribe',
      '#ajax' => [
        'callback' => '::ajaxSubmit',
        'wrapper' => 'message-wrapper',
      ],
    ];

    $form['messages'] = [
      '#type' => 'container',
      '#attributes' => ['id' => 'message-wrapper'],
    ];

    return $form;
  }

  public function getFormId() {
    return 'skb_subscription';
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {

  }

  public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
    drupal_set_message('Thank you for subscribing');
  }

}

It works correctly when a route is defined. When i go to the page /skb_subscribe_form the callback works correctly.

skb_subscription.subscribe:
  path: 'skb_subscribe_form'
  defaults:
    _form:  '\Drupal\skb_subscription\Form\SubscribeTag'
    _title: 'SKB Subscription'
  requirements:
    _permission: 'access content'

But when i try add the form to a block using the code

class SubscribeBlock extends BlockBase {
  public function build() {
    return \Drupal::formBuilder()->getForm("\Drupal\skb_subscription\Form\SubscribeTag");
  }
}

i get the following error "A fatal error occurred: The specified #ajax callback is empty or not callable."

I tried changing the callback with

$form['actions']['ajaxsubmit'] = [
      '#type' => 'submit',
      '#value' => 'Subsscribe',
      '#ajax' => [
        'callback' => '\Drupal\skb_subscription\Form\SubscribeTag::ajaxSubmit ',
        'wrapper' => 'message-wrapper',
      ],
    ];

but still getting the same error.


texts: Is it possible to create a view to show a field from a user acc and content?

texts:
when i create a view in Drupal7 i have to choose what i want to display ( like Users, Content, Terms ... ) .

Is it possible to choose Users and Content?

My problem is:

I have a geofield field in the User Account and in 2 content types. I need a view where i can display this field from all Nodes and Users in one view.

Has someone a trick or a solution for this? I can't find anything about this...

Thanks Flo


texts: How to show a view of content types on another content type

texts: I have one content type 'class' and I have another content type 'lesson' and I want to easily display all lessons that belong to a class on the view of a 'class.' Is this possible and if so, how?


texts: How do I in code add new field values to a D8 content entity?

texts:
How do I in code, create a new field value, add it to a content entity, and then have it saved to the DB?

Field API is dead. Long live Entity Field API! clearly shows how to read values, but doesn't mention inserts/updates.


texts: Can anyone show me how to use the Signup Module? I don't see anything in Structure or Add Content. I'm sure I just missed the link somewhere but I just can't figure out where.


texts: How to attach a database of data to a content / entity type

texts:
I have an sqlite database representing a collection of Foo which is immutable. I would like to be able to take this collection of Foo in the GUI of Drupal, and append a few fields onto each Foo instance, these new fields are to be editable.

I see no point to inserting the data as nodes / entities directly as the data is only going to reflect what's already in the database and inserting data using node_save is incredibly slow for duplicating the data.

How would I accomplish this so that a content-type / entity type uses data from another database, but manages a few additional editable fields?

Would it be a custom content type with a module to manage the pulling of the data from another database, or would it be a custom entity?


texts:
I want to remove comment link (actually it is li element) from node teaser view on homepage and term listing. I want ways to do in controller/service or in template or if possible in admin.

I have created links--node.html.twig in my template and place the following code:

{% if links -%}
  {%- if heading -%}
    {%- if heading.level -%}
      <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }}</{{ heading.level }}>
    {%- else -%}

{{ heading.text }}

    {%- endif -%}
  {%- endif -%}

    {%- for key, item in links -%}

        {%- if item.link -%}
          {{ item.link }}
        {%- elseif item.text_attributes -%}
          {{ item.text }}
        {%- else -%}
          {{ item.text }}
        {%- endif -%}

    {%- endfor -%}

{%- endif %}

as here was told. But it did not help my as links go in loop. I could insert if condition. But I do not know variables. I tried dump item from loop but a page was loading without the end. I do not want to use twig in to search for needed item. Actually I need the right way(s) to remove comment link.  If I can check for key, item in links if item.name != "comment" it could be great. But I prefer do it in code like in proper way without hacks.


texts: How to display a custom block in a view?

texts:
I created a custom block "Share". This one is not displayed on any page.

I installed the "Twig Tweak" module.

How to display a custom block in a view ?


texts: How to change the date format for date entity field

texts:
I created an entity with date field. Currently the date is being output in the format "mm/dd/yyyy":

How can I use the format "dd.mm.yyyy"? I couldn't find any settings, related to it, in the field configuration form.


texts: drush make: Specify subdir for make-files provided by contrib modules

texts:
Recently I started using drush make to pull in Drupal Core, all the required contrib-modules, themes and libraries.

One of the modules I use is the geshifilter-module. This module comes with it's own make-files, so when I run drush make to build my entire site, drush sees this make-file and also builds that to pull in all the dependencies for the geshifilter-module.

While this is really convenient, I have one small problem with this: I prefer to have all the contrib-modules in sites/all/modules/contrib, so I define my modules like this:

projects[geshifilter][subdir] = "contrib"

However, the make-file inside geshifilter doesn't specify this subdir, so as a result, drush downloads the dependencies to just sites/all/modules instead of sites/all/modules/contrib.

For the moment I have added some commands in my wrapper-script around drush make to move those dependencies to the contrib-folder after drush make has finished, but I'm wondering if it is somehow possible to override the subdir-property for make-files which are provided by modules (obviously without manually modifying those make-files). I'm using drush 4.5 (default one from Ubuntu 12.04)


texts:
I'm wondering if there is en option to apply og membership to all the entity referenced children of an node.

I have a content type 'Enterprise' which can reference itself to create a structure of enterprises. F.e. (Enterprise 1 --> Subenterprise 1 --> Subsubenterprise 1)

When enterprise 1 is added to a group all dependent nodes should be added also.

Thanks in advance for your advice


texts: Currency resolver - Cache problem on platform.sh

texts:
I'm using currency resolver (commerce) based on cookie to switch currencies in block (have a custom field for usd price in price variant). Locally everything's work fine (apache) but on platform.sh switcher block is not working.I think it has to do with some server caching (internal cache is disabled in drupal). I tried to add some yml config on platform.sh for disabling cache but without result. Did anyone have similar experience with this?

Thanks


texts: How to customize my front page with background image?

texts:
I have site for which I need to design a custom front page using my sub-theme with page page--front.tpl.php.

I need to place a background image and on title at left alignment and little bottom thre image background buttons and in that bottom center need to place on caret with hyperlink which will take you to rest of the half page.

Any suggestion?


texts: how to test if a node is flagged in twig

texts:
I would like to know how to test if a node is flagged.

In D7 : if ($ flag-> is_flagged ($ node-> nid)) But I discover D8 and I do not see how to do it with twig

thank you in advance


texts: Css class for Custom Content type fields

texts:
I'm using seven theme for creating a basic pages. In that created more content types including title and body as shown in figure.

The page appear like this.

Is it possible to add css class/styles for arranging beautiful manner. Like add custom css class for channel and language ..... How can I do this please? Thanks!


texts:
I have a fairly active Drupal 7 environment and I would like to track and log certain things about my users and their behaviour.

What are some of the approaches people tend to take to this? Ideally I'd love to graph some kpi's for reporting etc.

For example I if wanted to track (and log for comparison) things like:

Number of new users this day/week/month
Number of new nodes of 'content type' created this day/week/month
Number of new comments this day/week/month
Most active users (not just in terms of content created but also number of logins, number of comments etc...)

On a per user basis I love to know things everything I can reasonably find about behaviour.

Danny.


texts: Serve compressed JS and CSS with S3 as filesystem

texts:
We have a Drupal 8 site using S3 file system integrated via the S3 File System module.

The aggregated CSS and JS are uploading on S3, however I am not seeing any configuration to serve compressed files.

Can someone suggest a way or any configuration that I am missing?


texts: How do you inject dependencies in your classes from external packages?

texts:
My project has external PHP packages pulled in via Composer.

I would like to inject one of the classes in that package as a dependency, instead of do new Class(); inside my Controller methods.

The documentation says you can define a service like the following:

services:
  mymodule.example_service:
    class: Drupal\path\to\Class

What do you do when you want to use an external PHP package not native to Drupal?


texts: Why is the content of the  tag no longer loading in Google Chrome?

texts:
For some strange reason, the content of the <head> tag no longer loads in Google Chrome Inspector. The CSS files are still loaded.

Does anyone have a fix for this?


texts: What is the correct way of logging in through services from android?

texts: I currently have an app in development where I use services 3 on drupal 7 to login to my site. I do this by simply passing in the username and password parameters to a json object and use httppost to post them to service endpoint. Using the response I grab the cookie and store it in sharedpreferences on android which is used in all the following requests. I have this cookie set to be used for several days so the user wont require login again. Do I have any reason to be concerned about the security of this (I dont store any passwords) and if so what are the extra steps I can take and how to beef up the security but still allow for users to remain logged in? I have played around with the oauth module a bit but it seems rather complicated to implement on both drupal side and android. If oauth is my best option what are the steps to take to implement it with drupal and android?


texts: What is best practice for the amount of entity bundles, related to performance

texts:
My site uses ECK entities

In my use case it is easier to work with many bundles under one entity type instead of multiple entity types
(because in Panels, Views, Flags, separate entity types require separate instances, data of one entity type is relatively isolated to another entity type, thats why I don't use multiple entity types)

I want to be sure that this does not impact the site performance.
The site currently uses one entity type with approx. 30 entity bundles.
I also do not use the built in taxonomy system, but use entity bundles instead.

I don't use custom entity type properties, apart from the standard ones (title, author, created, etc.)

Is it advisable, from a performance standpoint, to start using more entity types?


texts: phpwkhtmltopdf engine pdf printing configuration issues

texts:
The screenshot below shows my Entity Print configurations for created styled PDFs from node content.

As shown in the screenshot I am using the phpwkhtmltopdf engine and the mikehaertl/phpwkhtmltopdf package is installed via composer.
However, when I try generating the target PDF, the following errors results:

Error generating document: Failed to generate PDF:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 1:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: cannot open
?php: No such file
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 2:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: namespace:
not found /opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 4:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: use: not
found /opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 6:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: /bin:
Permission denied
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 7:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: INSTALL.txt:
not found /opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 8:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: INSTALL.txt:
not found /opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 9:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: INSTALL.txt:
not found /opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php:
10: /opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php:
INSTALL.txt: not found
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: 12:
/opt/drupal/vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php: Syntax
error: newline unexpected

I gave Pdf.php 777 permissions too.
Can anyone help, please?


texts: Change Created Date to date from field_post_date

texts:
I am changing a large amount of news content types 'Created' dates. I figured out to use VBO with execute php and this code...

$entity -> created = strtotime($entity->field_post_date[LANGUAGE_NONE][0]['value']);
node_save($entity);

This code works!


texts: Globally rewrite broken image links in node bodies

texts:
I'm migrating my site from Drupal 6 to Drupal 7, and while most of it just worked after migration, the change from the Image module to the core image handling left a large number of broken images on the site.

Images that were inserted in the node body were not handled at all by the migration, and the links are now in an invalid format. Fortunately, fixing those links is pretty straightforward, I just need to change

http://mysite.com/sites/default/files/images/[image-name].[style].jpg

to

http://mysite.com/sites/default/files/styles/[style]/public/images/[image-name].jpg

This looks like it should be relatively straightforward to do, but I didn't find an easy way to do this replacement. I found the Search and Replace Scanner module, but that doesn't seem to allow using parts of the original match in the substitution.

How can I fix these image links all at once without having to do it manually?


texts: How do I construct the JSON data with session info for creating node?

texts:
I am using Drupal 7 and the Services module 7.x-3.2. I am using Postman for Chrome (a http client) to test the API.

What I want to do is log in a user and create a node with the user using the Drupal service API.

I logged in the user with JSON POST request to http://example.com/api/user/login.

I successfully got the JSON result.

{
    "sessid": "KrZjlcY3rFr8v6iLoskcVQN9DmDWsg5yZqIjBeydEBY",
    "session_name": "SESS9fe39db36ccd7afd64e034fefa0129e1",
    "user": {
        "uid": "31",
        "name": "test_user",
        "mail": "services_user_2@example.com",
        "theme": "",
        "signature": "",
        "signature_format": "filtered_html",
        "created": "1352985941",
        "access": "1352991170",
        "login": 1352991510,
        "status": "1",
        "timezone": "",
        "language": "",
        "picture": null,
        "init": "services_user_2@example.com",
        "data": false,
        "roles": {
            "2": "authenticated user"
        },
        "rdf_mapping": {
            "rdftype": [
                "sioc:UserAccount"
            ],
            "name": {
                "predicates": [
                    "foaf:name"
                ]
            },
            "homepage": {
                "predicates": [
                    "foaf:page"
                ],
                "type": "rel"
            }
        }
    }
}

Then I tried to create an article via the API by sending the JSON POST request. (The user has the permission to create Article nodes.)

I got a 401 Unauthorized response.

I guess I need to include the session cookie information to send the POST request, to create a node.

I have the session information previously returned.

"sessid": "KrZjlcY3rFr8v6iLoskcVQN9DmDWsg5yZqIjBeydEBY",
"session_name": "SESS9fe39db36ccd7afd64e034fefa0129e1",

How can I utilize it to make a successful JSON POST request for creating a node?


texts: How to import nodes with entity reference field through feeds?

texts:
At the moment i have 2 content types.
The first (Target Communities) is a kind of category listing. These nodes already exist.

The second (Areas, many more nodes) shall be created from a csv import.

The Areas content type has a entity reference field set to the Target Community content type.

I assumed that i just attach the Target Community titles to the Area in the csv, but after import and node creation, the reference field is still empty.

Then i tried the import with the Target Community node id instead of the title, but this doesn't work eather, the entity refernce field in the created nodes remain empty.

So now, I'm quite clueless about what else to try or what other settings I may have missed.

The feed mapping is correct, all other fields work, including term references etc.


texts:
So, time and again I've come across the requirement to create a "custom" or "landing" page which pretty much narrows down to this:

The co-existance of manageable text/content along with predefined views and/or blocks

For example:

-----------
|[managed |
|    text]|
|- - - - -|
|[View    |
|    pane]|
|- - - - -|
|[HTML    |
|   block]|
|_________|

Page Manager seems to be the way to go, but apart from using a block to accomodate my Managed Text (in this example), and thus creating a block for "non-blocky" purposes, and using it as an HTML containing entity, I cannot think of a better way.

So, tl;dr version:

Which is the optimal/Drupal way of having predifined and managed content bundled up together in a single page?


texts: How do I change a field description using hook_form_alter()?

texts: I used to simply replace the string in the #description property, but now it isn't a string and I am not able to change it.


texts: I am using the Image module along with ImageGallery to make galleries in Drupal 6. I now have some 'holes' in my gallery where Image can't find the thumbnails, so they need to be regenerated. How do I force that to happen? Have tried clearing caches and running update.php, but I still have the holes. Am I missing something?


texts: Change a output value of a field in a view

texts:
I've a view where one of the fields 'titleColor' has the option to return '#000000', '#FFFFFF' or '#FF0000'. I need to show instead of this values 'black', 'white', and 'red'. How can I do it? I've use in other cases Views Conditional  module, but I only can insert one else clause.

I hope you can help me,

Thank you very much.


texts: How do I fix Bootstrap 3 logo dropping down below navbar

texts:
I will be working on a project soon using drupal 8 that has bootstrap 3 installed.  so I set up a test server (located here: test server) to start familiarizing myself.
I figured out a bunch of things, but there is an issue with the bootstrap nav and logo.  The logo is dropped down under the navbar.
So I think I know it is outside the container, but I don't understand how/why this is happening.  I started investigating the bootstrap version and the jquery version, but those seem to all be fine.
Has anyone else run into this? (I know, not many people are still using TBS3)
Any ideas on what else I should be investigating and how to resolve?
Thanks in advance.


texts: How to add a custom Link into $content['links']?

texts:
I need help with solving following problem:

In my node content type (called "hotel") I'd like to add a custom link to the existing links which are put out via $content['links'].

The custom link shall only appear at the hotel content type.

What I have to do? What theme function do I have to modify and how?

thanks for any help.

phil


texts: Internal Server Error? Why is this happening?

texts:
All normal to start my website, but to click on any of the links, menus, etc, I get redirected to this with the following message:

Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete your request ...

Why is this happening?
What happens is that had risen another database project (one domain to another) I think it has a lot to do this.
There a way to fix it? Perhaps when exporting the database did wrong, what I want is that this database will serve me for several other projects. other domains.
I need your comments, help or suggestion


texts: Division by zero in theme_image_style_preview after moving to production server

texts:
Warning: Division by zero in theme_image_style_preview() (line 804 of
  /var/www/html/modules/image/image.admin.inc).

  Warning: array_intersect_key(): Argument #1 is not an array in
  theme_image_style_preview() (line 806 of
  /var/www/html/modules/image/image.admin.inc).

I am receiving the above errors when I view several of the "stock" image styles on my site. I just moved my site from a development server to a production server, and the error does not occur on the development server version. I checked the directory permissions on the production server, and they appear to be consistent with the development server's permissions.

One really strange thing occurs when I view the source on the "preview image" in the admin back-end of one of those styles that has the issue. When I do, it shows the following path being called (which is, of course, not a valid path):

http://mysite.com/sites/default/files/styles/large/public/modules/image/sample.png?cache_bypass=1399676683

The "sites/default/files/styles/large/public/" part seems to be part of the issue, but I am not sure how that got there. All of my custom image styles work fine.

Thanks!


texts:
I need to access the raw menu data in a menu block, but $content only stores the rendered markup. How can I gain access to this object from within the block--sidebar_second.tpl.php file?

I've looked into creating a View but I couldn't figure out how to select menu nodes. Either solution will work for me...

Here is the output of the $block object:

stdClass Object
(
    [bid] => 196
    [module] => menu_block
    [delta] => 7
    [theme] => theme-name
    [status] => 1
    [weight] => 0
    [region] => sidebar_second
    [custom] => 0
    [visibility] => 0
    [pages] =>
    [title] => Services Menu
    [cache] => -1
    [subject_array] => Array
        (
            [#markup] => Services
        )

    [subject] => Services
    [last_in_region] => 1
)


texts: How to Invalidate cache for views by user's location

texts:
My site using Drupal 8 last version (8.2.5) and we have the views which contains the filter based on user's location (time-zone). For example, the users are coming from UK will get the time in UK timezone, and the Users are coming from the US, will get the time in the US. The problem is, when anonymous users from UK accessing to the site, it's display as US time instead, because the page has cached from US when the users from US visited.

On Drupal 7, I had implements DrupalCacheInterface and set custom cache for APC. And it's working fine.

How can I customize Drupal 8 cache for this requirement? My web server enabled the opcache and I and a custom module already.

Updated:

After reference from Cache API from drupal.org, I tried to use Cache Context for TimeZone.

Inside default.services.yml, I modified:

# @default ['session', 'user']
  contexts: ['timezone']
  # Tags with a high invalidation frequency.

For make it filter by context request, when detect difference timezone will render cached pages according. But seems it's not working on Anonymous page cache.

Anyways for resolve my issue?


texts:
I'm currently trying to translate a timestamp field of a content type, but month names are always in English. I want the following format in English and French:

English : 3 November 2016
French : 3 novembre 2016

Code 1 (always in English)

# node--content-type.html.twig
{{ node.field_ends_at.value|date("d F Y") }}

Code 2 (always in English)

# Pass trought field display (Structure > Content type > Manage Display > Format Custom (d F Y)
# node--content-type.html.twig
{{ content.field_ends_at }}

What's the best way to handle date formatting and translation?


texts: How to use traditional (national/native) dates and calendars?

texts:
How can use non-Gregorian dates and calendars?

I adjust Drupal setting to my native language (fa) and native location (Asia/Theran) but month name and number of years also in Gregorian yet (however there are translated to my native language-persian).

I already use format_date() or date() in theme files, but this function is not locale-aware, which means that it always outputs English language data, such as day and month names and ordinal number suffixes.

I want to show the month names in the native language (e.g. Chinese, Islamic, Hebrew, Farsi/Persian) and use the national calendar (e.g. Irani, Shamsi, Jalali).

I want to understand is there any module or hardcoding solution in Drupal to show dates and calendars in other non-Gregorian calendars.

Any suggestions?


texts: Email users on node creation based on location

texts:
I have location module install, which are referenced on both user and node (type: property). When a node (property type) is created, I need to email all users who have same location of node what created. At lest match with City/Zipcode field for the node.

Is it possible with rule? I do don't know coding. So your help is only hope for solve this problem.

Thank You.


texts: File_load for image path errors when empty

texts:
I need to print the URL of an image in a content type TPL file. I can do this with the following code:

<?php $file = file_load($node->FIELD_NAME['und'][0]['fid']); ?>
<?php print file_create_url($file->uri); ?>

However if the field is empty then I get errors on the screen. I tried only printing the URL if $file had a value:

<?php if (!empty($file)): ?>
  <?php print file_create_url($file->uri); ?>
<?php endif; ?>

However im still getting the errors if the field is empty. I understand that it is the first line of the code which creates the variable that is causing the issue. How can I rewrite this to not cause errors?

By the way im a themer not a back-end developer so if there is a more 'themer friendly' solution that would be my preference.


texts: How to have display suite extra show up as layout options when creating blocks?

texts:
What I do now is create a content item.

Choose a layout.

Create content.

Use Node as Block to show as a block.

Would it be possible to have display suite extra show up for layouts when creating a block? So the block can have layouts?


texts: Add HTML5 required attribute to webform fields set as required

texts:
Could someone advise me how to use a hook to add the HTML 5 required attribute to all inputs that have been selected as 'required' within webforms.

Webforms already adds class 'required' but the HTML 5 required attribute provides great instant validation in Opera, Firefox and Chrome browsers.


texts: How to extend entityreference field by another custom field?

texts:
I want to add another field, which needs to be accessible by views (for display and ordering), to the entityreference table field_data_field_FIELDNAME. Structure of that table is:

entity_type VARCHAR(128)
bundle VARCHAR(128)
deleted TINYINT(4)
entity_id INT(10)
revision_id INT(10)
language VARCHAR(32)
delta INT(10)
field_FIELDNAME_target_id INT(10)

I want to have a column storing DateTime information here, so I can attach information about when this reference was added/ updated for that referenced entity. There also needs to be a way to save the newly added field directly in the array structure for that reference such as:

$node->field_reference['und'][] = array(
  'target_id' => 123,
  'my_new_column' => '2014-03-13 15:29:29'
);

I know I could solve this by using field_collections or relation module, but both would cause significant performance issues.


texts:
I'm currently migrating PDF files into a content type. I would like to know how to populate the file information description field with a more meaningful link (e.g. give a description to each imported file).

$arguments = MigrateFileFieldHandler::arguments(drupal_get_path('module', 'my_migrate').'/docs', 'file_copy', FILE_EXISTS_RENAME);

$this->addFieldMapping('field_publication_download', 'files')
  ->arguments($arguments);


texts: entityQuery to get Nodes referenced by other nodes like an SQL JOIN

texts:
I have an entity query to get content of type article that has a field that matches a given value, which works as expected.

$query = \Drupal::entityQuery('node');
$query->condition('status', 1);
$query->condition('type', 'article');
$query->condition('field_some_field', 'some value');

Now I have a second content type detail_page that has an entity reference to a node of type article. I would like to get content of type article, same as before, but only those that have been referenced in the field_detail_page_article_ref field of a detail_page content type.

Is that possible with Entity Queries? Playing around with the raw SQL, what I basically need to do is an INNER JOIN or LEFT JOIN with the field field_detail_page_article_ref to see if the nid exists. But it doesn't seem like there is any sort of join() function available for entity queries.


texts: Calling two namespaces for formbuilder and controller in d8

texts:
I have a d8 form as follows ,and am calling a new class by including the file in the formbuilder class , But its throwing me a class not found error ,although am including the class in the form builder and namespace in the calling class .

    namespace Drupal\module_name\Form;

    use Drupal\Core\Form\ConfigFormBase;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\Core\Form\FormState;

    //included class
    require_once './' . drupal_get_path('module', 'gasf') . '/includes/config_class.inc';

    class ClassName extends ConfigFormBase {

      public function getFormId() {
        return 'class_name';
      }
    /**
     * General form for switching all nodes from one user to another.
     */
      public function buildForm(array $form, FormStateInterface $form_state) {
      $Config = new ConfigClass();
      $operations = array(
          'IP -> vm name',
          'vm name -> IP',
      );

    $argument = empty($argument) ? '' : $argument;
    $operations = empty($operations) ? '' : $operations;

    $form['argument'] = array(
        '#type' => 'textfield',
        '#title' => t('Enter argument here'),
        '#default_value' => $argument,
        '#description' => t('Depending on operation: tcp/ip adress or vm name'),
    );

    $form['operation'] = array(
        '#type' => 'select',
        '#title' => t('Operation:'),
        '#options' => $operations,
        '#description' => t(''),
    );

    $form['submit_lookup'] = array(
        '#type' => 'submit',
        '#value' => t('Lookup'),
    );

    return $form;
}

and in the config_class.inc i have

namespace Drupal\module_name\Controller;
namespace Drupal\module_name\Form;

class ConfigClass {

}

But its calling the latest namespace only , that is when i use namespace Drupal\module_name\Form; its working properly , But it wont take effect the namespace Drupal\module_name\Controller; namespace  .That will through error on calling the class from controller ! . How can i use the namespaces for both formbuilder and controller class ? Or is there any other workarounds ?


texts: How to the set permission of content types for a specific user role?

texts: How to set the permission of content types for a specific user role?


texts: Viewing events count grouped by taxonomy terms on Calendar

texts:
I am trying to view a count of events for each "event type", which is taxonomy field, using calendar but I am totally lost! Here is what I have done:

Created a "Event types" vocabulary and added terms like "Conference", "Journal" etc.
Created a "Event" content type with a term reference to "Event types", plus and a start date/time.
Created a new "view content" view, with type = "Event", displayed as a "Calendar" with fields.
Added the "start date field" as a contextual filter
Added "Nid" and the "Event Type" fields, and set "use aggregation" to true
Set the "Nid" to Count Distinct and "event type" to Group By.

However, using "Format->Display Fields" shows nothing! So I tried to use display as "Calendar Items" and display as "Calendar Entities" but, instead of showing the events count for each event type, it shows the events and and 1 as count.

Any idea about the problem or help on how to achieve what I am looking is very welcome.


texts: Way for Admin to log in as an existing user without password for troubleshooting

texts: I'm the administrator & sysadmin for a Drupal site with a few thousand users. In maintaining the site, sometimes I need to troubleshoot issues reported by users that are difficult for me to reproduce when I'm logged in as me. Discrepancies in our abilities to reproduce the issue could be caused by (for example) roles and permissions or ownership of content. In any case, I'd like an easy way to log in as that particular user to test and troubleshoot the situation. And obviously I don't want to ask the the user tells me their password. Is there an easy way to do this?


texts: How to add block to "add/edit" content page?

texts: is there a way to add views block to add/edit content pages? I have two content types and one of them has Taxonomy term baste with unique terms (one term per node), when creating new node I want to have block with unused terms. I tried to accomplish this using Markup module but no success, and Display suite and Panels didn't worked.


texts: Token authentication- "The form has become outdated" and rules issues

texts:
I'm using the Token Authentication and Privatemsg modules together.  When a user receives an e-mail notification that they he/she has received a private message, I have placed a link (using a token provided by the Tokenauth module in a query string) that allows the user to log in and see the message.

At the bottom of the page is the message reply form.  I would like the user to be able to reply via this form as well (without logging in, via token authentication).  However, when I tested this, I received the following error:

  The form has become outdated. Copy any unsaved work in the form below
  and then reload this page.

A Google search revealed this helpful comment on drupal.org:

  So it seems you would have to either

  unset($form['#token']) or $form['#token'] = NULL

Privatemsg has two message creation forms, the new message form and the reply to message form.

To fix the new message form, I added unset($form['#token']); to hook_form_privatemsg_new_alter() (new messages) and hook_form_privatemsg_form_reply_alter() (replies). I tested this and new private messages as well as replies can now be sent.

I then disabled caching for the privatemsg module so that the messages would always be refreshed.

However, I have a rule that is set to Show a message on the site ("Your message was sent to User X!") whenever a private message or reply is sent; this rule is not triggered when a private message is sent if the user is authenticated via Tokenauth even though the private message is saved to the database properly and displayed upon page refresh.

How can I make sure rules are still triggered when authenticated via Tokenauth?


texts:
I have a custom entity 'sponsor'.

I want to create a custom template for that entity. But I still want to use the formatter settings that have been defined in the UI.

So

I set the viewbuilder to the default EntityViewBuilder in my annotation
I defined the theme hook 'sponsor' in my .module file

function sponsors_theme(){
$theme_hook= array(
    'sponsor'=>array(
        'variables'=>array(
            'sponsor'=>null,

        ),

        'template'=>'sponsor',
    )
);

return $theme_hook;

}
Then I created my sponsor.html.twig file

Now I can access the raw values through {{sponsor.field.value}}

But I don't want to access all fields through their raw values. I still want to use the formatters.

Is there anyone who can tell me how to do that or point me to the right docs?

Matt.


texts: Theming a Fieldable Panel Pane — should I define a View Mode?

texts:
I added a Link field to Panopoly's Image fieldable panel pane, but I need to theme it so the link is silently wrapped around the image rather than displayed textually underneath. It also needs to be easily specified by content editors. (Use case: a full-width front page "hero image". Content editors should be able to specify a link for the image.)

How should I go about defining a new kind of Image FPP? Should I define a new view mode? (Since I want editors to be able to use link-wrapped images anywhere, a solution tied to the front page would be too restrictive.)


texts: Error 500 (Internal Server Error) After Clearing Cache

texts:
I truncated cache_block and cache_bootstrap tables in Drupal database (I don't know if its okay to truncate cache tables) and after that my site went down.

I am getting HTTP Error 500 that says

  The website encountered an error
  while retrieving www.drupalwebsite.com. It may be down for maintenance
  or configured incorrectly.

Before truncating those tables, my site was working fine. Is there any way to get it back to working??

  UPDATE -

I cleared all other cache tables too...

WEBSERVER LOGS -

  [Thu Dec 27 02:51:24 2012] [warn] [client *IP_Address*] mod_fcgid: stderr: PHP Fatal error: Call to undefined function ctools_include() in /var/www/vhosts/*my_site_name*/drupal/sites/all/modules/views/views.module on line 62


texts: How to display the replies count of the each user comments with show/hide option in node view page in Drupal 7?

texts:
Now, I am having comments section like this in node view page.

  Comment 1
    comment 11
    comment 12
  Comment 2
  Comment 3
    comment 31
    comment 32
    comment 33

But, I would to show this with show/hide option for replied comments with replies count. like below

  Comment 1
    show/hide 2 replies
    ------------------
    | comment 11     |
    | comment 12     |
    ------------------
  Comment 2
  Comment 3
    show/hide  3 replies
    ---------------
    |  comment 31 |
    |  comment 32 |
    |  comment 33 |
    ---------------


texts: How to change the order of attributes in the Ubertcart cart page

texts: In the screenshot, you can see that the attributes for this product are listed in seemingly random order.  Actually, it seems to be ordered by the attribute ID.  Is there a way to change this order?  Each attribute has a "List position" property but this only seems to be for the product page, it doesn't affect the cart.


texts: Attributes in table in custom content type form

texts:
I am creating a custom content type named "Invoice".
 This content type is having attributes like Company Name (entity reference to company content type), Bill details, tax details and calculations.
Can you please suggest how can I get elements/attributes like shown in an image in custom content type add new content form?


texts: Views Data export gives AJAX error on batch exporting

texts:
I am trying to use Views Data export to export an XLS in Batch mode, and I get this error:

Building export
Export has encountered an error.
Please continue to the error page
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=558&op=do StatusText: OK ResponseText:

This is the error : .OriginalPDOException: SQLSTATE[42000]: Syntax error or access violation: 1118 The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size


texts: drupal 7 on virtual server with debian linux - inconsistent response time

texts:
I have drupal 7 test installation on shared hosting. Caching turned off (I do not want to use caching), cron disabled. According to devel, query execution times on page with 228 queries are approximately 1200ms.(some views blocks with relationships, page displayed using context) Loading time of this page is allways more than 1200ms. It is approximately 3 and more seconds. Due to time to first byte, which I am not able to cut down.
However, I decided to try the same install on virtual host running on debian linux 500mb ram. Devel shows on the same page (228 queries) time 50ms - which is great.
But, accessing time to pages is very inconsistent. Sometimes it is amazingly fast, sometimes it takes 8 seconds of waiting and then page loads. What is interesting - even if page loads after 8 seconds, the query time is allways small according to devel.  This leads me to conclusion, that there must be some bad setting on my linux installation. Can anybody point me to the right direction? Thank you

I am new to virtual servers and I think I am missing here something obvious.


texts: Drupal 7 treat html 5 data attributes as text

texts:
First I wound like to clarity i am not asking for code.

This code work on html 5.

I create basic page in drupal and implement same code:

Drupal treat data as text and print this:

data-top="opacity: 1" data--400-top="opacity: 0" class="abc"

Do I need any module to enable html5 data attributes?

I am using FULL HTML and I have no idea how to solve.

Many Thanks.


texts:
I'm using the Drupal Commerce module to build a Website to manage two Flats to be rented by days.

The visitor select one of the two flats and then select a date (let's say it the day: 15 January 2012) and make the payment for it.

After the payment the date of 15 January 2012 will not be available to be sold again until this day has passed (the 16 january).

I first thought of creating a product type called: Day to rent with a field called: date and then creating 365 'Day to rent' products, each one for each one of the days of the year, setting the field 'date' to the corresponding date.

Then, using the calendar module and views I would show the products in the calendar allowing the visitor to click in the 'add to cart' for the day they choose.

I'm a Newbie with the module, and I now see that I cannot get 'products' inside a view. Then, my idea fails.

Now I think that I should add the field called: date to the 'Product display' instead of the product itself, but I am not sure.

Before wasting hours, I just need to know if is there any way I can accomplish this with the commerce module.
Do I need an affiliated module? Do I need to develop a new module?
What is the best approach to do it?


texts:
The following doesn't work after calling the $node->type. Can someone help?

$nid = 0;
$term_1 = "";

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

$node = node_load($nid);

if(true == strpos($node->type,'article'))
{
    $result = field_view_field('node', $node, 'field_tags_test', array('default'));
    $term_name = isset($result['#items'][0]['taxonomy_term']->name) ? $result['#items'][0]['taxonomy_term']->name : "";
   }
 }

If I take out the inner if-statement, then it works just fine.

Thanks for any help.


texts: Is it possible to disable theme debug in one field? I don't want to disable theme debug, but when I set up background file from field, theme debug comments block this style functionality.


texts: Is there a way to globally redirect taxonomy paths -- on a pattern?

texts: I know there is url alias but what I need to happen is the taxonomy path be redirected to a view. The itemization will be from a tag. This tag basically controls a views output. I want to have that terms URL be redirected to that view page.


texts: How to build an advanced search form for the search api

texts:
I have custom content types that represent documents stored in Drupal; each content type has different fields but also some in common like:

title
language
date
attached text

I am currently using the Search API and Solr to index them.

I 'd like to create a search page like those created by the Search pages module that has two versions:

A simple search form with one search box that searches the attachment content and returns highlighted search results
An advanced form that includes extra search boxes e.g. for title, and date

I know how to do the advanced form with Views, but I am not totally satisfied with the fulltext search exposed field.

Could someone guide on which steps to follow?


texts: Use entity_metadata_wrapper's field->getBundle on a multiple field

texts:
I have a multiple field on an entity, and would like to get the $wrapped->field_profiles->getBundle() property as an array from all the results, but it doesn't seem to be working for me, although I know it should be super obvious. My current non-wrapper-ish way of doing it is like the following code, but I'd prefer a clean one-liner. Is this possible? Thanks!

$wrapped = entity_metadata_wrapper('node', $result);
array_map(function ($profile) {
  return $profile->type;
}, $wrapped->field_profiles->value());


texts: How to quickly update/reinstall using Drush 4.x

texts:
Whilst trying to update Drupal 7.0 core and installed modules using Drush 4.x I appear to have broken a project site (Ubuntu 11.04 box using pure LAMP) and hence I get the dreaded 'white screen' so cannot get past it or get into the backend of the site. I would like to simply get D7 core/and all current modules (which there is a good 40 modules or so) updated and back working. It is a project for learning but I have done a good fair amount of work on it over the past 6 months and really I don't want to trash the mySQL DB and start all over again as I'll lose a fair amount of hours work. Can anyone provide a Drush command to get it back up and running whilst also updating the D7 core/modules and get it back on track. I understand the concept of the Drush CLI, but am really a 'learning' novice at present across all of the Drupal framework. The modules included are the general Panels/Rules/Views (PRV) etc along with Ubercart and subscriptions etc so a fair amount of PRV work has already been done.

I also get the following:

  PHP Fatal error:  Class 'RulesIdentifiableDataWrapper' not found in
  /var/www/sitename/sites/all/modules/flag/flag.rules.inc on line 27
  Drush command terminated abnormally due to an unrecoverable error.

So what do I do now??, I really don't want to start the whole project all over again after spending a good 6 months on this project.

Concluding:
The whole process trashed my project site. Some 6 months work (with a lot of typing input) may have gone. the mySQL tables are still there and the data has been backed up, but whether I can get d7.14 and the current used modules and all the P/R/V and Ubercart user subscrition data to work is still to be seen. I'm sure this is NOT the way to be efficient in web building and management.


texts: Alter the access of menu links before rendering

texts:
I need to alter the access of menu links before being rendered. In Drupal 7, we used hook_translated_menu_link_alter() for it. Drupal 8 change records show that there are no direct replacement for that hook.

Is there any other hook or controller to alter the access of the menu link before it is rendered?


texts: Field Template Loop Counter Override Problem

texts:
I'm using a template override for field.html.twig

I'm simply trying to generate a data-depth attribute that takes the index of the loop and multiplying it by 0.2.

Here is the Twig markup:

  {% for item in items %}
    {% set i = loop.index %}
    {% set depth = i * 0.2 %}

      {{ item.content }}

  {% endfor %}

Here is the HTML output:

As you can see the first two iterations are the same - they have 0.2 as the data-depth which is incorrect it, the sequence should be 0.2, 0.4, 0.6, 0.8 and 1.0. Is this is a bug with drupal? Or am I totally missing something here.

Thanks in advance.


texts: I'm using the Full Calendar module.It's all working fine, but I can't figure how to add events to it. I've read the docs, I can see you can set up a feed to a Google Calendar which is cool,but I want to enable the user to add events right there.


texts: Redirection message after the form is submitted

texts:
I have a customized webform; after user submission there will be a dynamic ticket number shown in the confirmation message. If I want to show purely a customized message, how do I do this?

I've tried to create a dynamic link to a page that displays that message, but when I try to refresh the page, that just disappears.

For example: user filled the form -> show a message -> show the dynamic ticket ID.


texts: how to create Views exposed filter with fields from custom table

texts:
I have one of custom table with fields named title and id. Now I want to add the title field in views exposed filter as drop down.

How to create exposed filter for this?

Could anyone explain where I can find this?


texts: Restrict comments on nodes of a content type based on user role

texts:
I am building a site in Drupal, where there are 2 different types of registered users. Let us call them basic users and premium users. These could be roles, or groups, or something else.

Authorized users will be able to publish pages with simple content and comments underneath. All pages are viewable publicly, even by non registered users and so are the comments.

Only registered users should be able to post comments.

What I would like is for some pages to allow comments only from premium users. So, there would be two categories of pages. Again let us call them basic pages and premium pages.

The permissions would be as follows:

Basic pages
READ: all
COMMENT: basic users, premium users

Premium pages
READ: all
COMMENT: premium users

Any help/pointers would be appreciated, as I have limited experience with Drupal.


texts: Pass clean URL test with IIS and Ionic rewrite module

texts:
The IT department moved my drupal 6 site to a new server. It is IIS7 server with ISAPI Rewrite Module (Ionic).

My main problem is that the clean URLs do not work. I have set this up thousants of times on Apache machines, but IIS is new to me, and with Ionic.

Things I have tried googling around and looking at the drupal man page for cleanURLs:

Added this to .htaccess:

    RewriteEngine on
    RewriteBase /antor/  #both leaving this line our, and tried with #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

But does IIS even look at htaccess? So I also created a web.config file with this

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <rewrite>
    <rules>
      <rule name="Drupal clean URLs" enabled="true">
        <match url="^(.*)$" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          <add input="{REQUEST_URI}" negate="true" pattern="/favicon.ico$" />
        </conditions>
        <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
      </rule>
    </rules>
  </rewrite>
</configuration>

Then I got: internal server error 500.

But perhaps the rewrite module does look at htaccess? I am puzzled...


texts: Set default registration type for content type

texts:
I created a registration type for a certain content type using the registrations module (https://drupal.org/project/registration).
But the user can select or disable a registration type.

Can you force this registration on a certain content type?


texts:
I will try to keep the question simple and short. I have (Drupal 7):

a Vocabulary "Country regions" (depth 1 level):
Austria
-Burgenland
-Tyrol
Belgium
-Arlon
-Liege
-Namur
...

a Content type "Regional development programs" with a "Applies to:" field on this vocabulary, a terms multi-select field.

a View with an URL argument (a region) - contextual filter.

I'm trying to build a View to show all "Regional development programs" that use the parent of the given region.

Example:
URL: /get-programs/Liege/
I want to retrieve all programs that apply to Liege (given argument), which is easy, BUT I also need all programs that apply to the region parent, which is Belgium (because, of course, all Belgium programs apply to its regions as well).

Sorry if the solution is already given in another question, but I couldn't find a similar question (I found several questions for getting the children of an argument, but not for the parent).

Thanks a lot!


texts: How to programatically link payment with an order in Drupal commerce?

texts:
Version: Drupal Commerce 2.x.

I am creating orders programatically by following the instruction from the documentation. I looked for various resources but couldn't find any way to link payment with the orders created programatically. Is there a way to create payment instance and link it to order.


texts: I know I can load a node by its title with the node_load() function. Is it possible to load a node by its URL alias?


texts: Does a module for real-time data plotting exist?

texts: There are several Drupal modules that allow to plot /chart data stored in database tables. Is there any module that can chart or plot data in real-time? For a specific example, I have a mobile application that is reading sensor data (say from an accelerometer) and sends that to the Drupal server. I want to plot the data as and when updated in real-time or near real-time. Does any specific module that can do this exist?


texts:
I'm using the ajax_links_api module to "ajaxify" a certain menu. When a menu button is clicked, the corresponding node loads into a specified div via ajax. This works well.

The problem is that the nodes I want to load in this way should not be accessible as pages. I often create Drupal content that is only designed to appear in views, or as related content on other pages and is not supposed to be displayed by itself. My method is to use .htaccess to block these pages. But when I do that, the ajax can't access them either.

Is there a way to block access to pages in a browser but to allow requests coming from Drupal itself? Localhost access is not really an option since the site may well end up spread across different servers and virtual machines.

If not, then can someone recommend an alternative to the ajax links module - perhaps I need to write some custom ajax that triggers Drupal to serve up a node "directly" rather than via a page - but I am confused about this and could use some pointers in the right direction. I must admit I find the "example" modules confusing!

EDIT: I've tried making a custom module as David Thomas suggests below and using hook_node_access. However this stops the ajax call from returning the content.


texts: Why are field widgets not form elements?

texts:
Form elements are often separate from field widgets, yet they implement very similar functionality.

Sometimes, their functionality also creep across the two apis, such as in this question: Is displaying a working Field Widget Form on its own possible?

It seems logical to me that a field widget could be a form element, that also happens to map directly to some underlying storage, especially since form api was already in place when field api came about.

I'm wondering why this is not the case.

Edit:
As pointed out by kiamlaluno below, according to the official docs, widgets are Form API elements, which means I need to edit my question a little.

I came about wondering about this, because I wanted to use the Core tagging widget as a form element. To the best of my knowledge however, there is no easy way of doing that. Despite the docs claiming widgets are elements, that does not seem to necessarily be true.

If a widget was declared as

function hook_widget_info() {
  return array('my_widget' => array(
    'base element' => 'some_form_element_machine_name',
  ))
}

then the element definition would be separate from the widget, so that it could be used on both ways, but currently this is not the case.

Edit 2:
Feature request opened.


texts: How to implement facebook feed which shows the latest facebook wall post

texts:
I would like to display latest facebook wall post on my website. I found the Facebook Pull module; but it doesn't work for me. I have add the appropriate app id and App Secret and nothing is showing up. Any ideas?

Do you know how  I can accomplish it? I never have a similar problem with a twitter_pull module which does the same but for the twitter.


texts: REST response gets cached for guest user requests

texts:
I've implemented kind of a page hit counter as REST request. The article page renders a JS into the page that does a jQuery.getJSON to the REST resource later.

So far that works fine. The page is delivered from cache (X-Drupal-Cache:"HIT") and the browser does an extra request to the REST resource (/api/v1/check/l/1?_format=json).

Unfortunately the REST handler is not called for guest user views. Instead, Drupal delivers the cached response. It only works for authenticated users.

For guest I get

Cache-Control:"must-revalidate, no-cache, private"
X-Drupal-Dynamic-Cache:"UNCACHEABLE"

BUT:

X-Drupal-Cache:"HIT"

And the REST handler is not executed. My REST response is

return (new ResourceResponse($rc))->addCacheableDependency(null);

Thanks


texts: Error when creating a custom Twig filter

texts:
I'm trying to create a custom Twig filter in Drupal 8. The goal is to use my custom filter in a template like so:

{{ a_variable|myfilter }}

I have created a custom module with 3 files:

MODULE.info.yml
MODULE.services.yml
src/TwigExtension/MyExtension.php

The MODULE.info.yml file contains the usual values.

The MODULE.services.yml file contains:

services:
  MODULE.twig_extension:
#   arguments: ['@renderer']  #  <-- Initial code (USELESS)
    class: Drupal\MODULE\TwigExtension\MyExtension
    tags:
      - { name: twig.extension }

The src/TwigExtension/MyExtension.php file contains:

namespace Drupal\MODULE\TwigExtension;

// use Drupal\Core\Template\TwigExtension;  // <-- Initial code (WRONG)

class MyExtension extends \Twig_Extension {
// class MyExtension extends TwigExtension {  // <-- Initial code (WRONG)

  /**
   * Generates a list of all Twig filters that this extension defines.
   */
  public function getFilters() {
    return [
      new \Twig_SimpleFilter('myfilter', array($this, 'myFilter')),
    ];
  }

  /**
   * Gets a unique identifier for this Twig extension.
   */
  public function getName() {
    return 'MODULE.twig_extension';
  }

  /**
   * Replaces all instances of "animal" in a string with "plant".
   */
  public static function myFilter($string) {
    return str_replace(array('animal'), array('plant'), $string);
  }

}

My initial code got following error: "Call to a member function generateFromRoute() on a non-object in /core/lib/Drupal/Core/Template/TwigExtension.php on line 224".

But I have now corrected the code following lauriii's answer and it works perfectly!


texts: I was wondering if it was possible to add cck fields of a certain node into the overlay of an image that is part of that node? The idea is to get a description of that image going in the overlay.


texts: How to filter a field in the add content window in Drupal?

texts:
I am very new to Drupal so I'm sorry for my lack of familiarity with Drupal terminology.

I have a content type with multiple fields (A, B, C, etc..). Each field is a selectable vocabulary list. I would like the user to select any terms in A and B fields. But I want only relevant terms to display in the C field (depending on A and B selections). In this way, A and B are independent fields and terms that appear in C are dependent.

Example:

Content type: Food dish at a restaurant

Field A: Appears on Menu type (Breakfast menu, lunch menu, dinner menu, wine list,etc.)

Field C: Appear in Menu section (Appetizers, Entrees, Deserts, etc.)

If the user selects "Breakfast Menu" for field A, it wouldn't make much sense to allow the user to select "Desert" for field C. But selecting "Appetizers" or "Entrees" would be fine. I want to filter the selectable terms in field C depending on which options are selected for field A.

Thank you for helping me out! Really :)


texts: Multisite with some shared content and some different content

texts:
I need to create 7 magazine sites with different themes but some content should be shared (like some common pages, some pictures etc).

There should be a common control panel for all websitea so that my customer can upload data on all websites from the same panel. The same content is required because the customer will upload articles on one and it should publish on all site.

I have already setup two demo site with different database on one hosting place and single Drupal installation.


texts:
How I can pass a form to twig template in Drupal 8?

For example, I get this:

a form: mymodule/src/Form/MyForm.php

Then on my Controller:

public function myController() {

    ??????

    return [
        '#theme' => 'mytemplate',
        ??????
        ];
}

mytemplate.html.twig

{{ ????? }}


texts: How can I make a user-friendly account approval for admins?

texts:
Right now on my Drupal site I have everything set to send an email to the administrator once an account is created.

The administrator receives a link that says a new account is created, and there's a link to the user's profile in the email.

Is there any way for there to be a little option on the user's profile page that just says 'approve user' (that only the admin can see), or for an admin to get a link submitted to him through the email that he can click to automatically approve a user?

I'd rather admins not have to dig through the backend, look up a user, and then edit the user and approve the account manually.  Is this possible? The most preferable would be the the administrator gets an 'approval link' in the email, so he can just click 'approve' from his email, and assuming he's logged in on the site, it automatically approves the new user account.


texts: oderid sort not work correclty in number more than 1000 in commerce_orders views

texts:
I look at the commerce_orders views, and I see some strange there, when I set sort record according by orderID it not work correctly for number more than 1000 ,it seems that only 3 first digit consider in sort, Is this a bug in views?
appreciate any help

and query is :

SELECT commerce_order.order_number AS commerce_order_order_number, commerce_order.order_id AS order_id, commerce_order.uid AS commerce_order_uid, commerce_order.created AS commerce_order_created, commerce_customer_profile_field_data_commerce_customer_billing.profile_id AS commerce_customer_profile_field_data_commerce_customer_billi, users_commerce_order.name AS users_commerce_order_name, users_commerce_order.uid AS users_commerce_order_uid, commerce_order.status AS commerce_order_status, 'commerce_customer_profile' AS field_data_commerce_customer_address_commerce_customer_profi, 'commerce_order' AS field_data_commerce_order_total_commerce_order_entity_type
FROM
{commerce_order} commerce_order
LEFT JOIN {users} users_commerce_order ON commerce_order.uid = users_commerce_order.uid
LEFT JOIN {field_data_commerce_customer_billing} field_data_commerce_customer_billing ON commerce_order.order_id = field_data_commerce_customer_billing.entity_id AND (field_data_commerce_customer_billing.entity_type = 'commerce_order' AND field_data_commerce_customer_billing.deleted = '0')
LEFT JOIN {commerce_customer_profile} commerce_customer_profile_field_data_commerce_customer_billing ON field_data_commerce_customer_billing.commerce_customer_billing_profile_id = commerce_customer_profile_field_data_commerce_customer_billing.profile_id
WHERE (( (commerce_order.status NOT IN  ('cart', 'checkout_checkout', 'checkout_shipping', 'checkout_review', 'checkout_payment', 'checkout_complete')) ))
ORDER BY commerce_order_order_number DESC
LIMIT 50 OFFSET 0


texts:
Ok, I have my own menu on my multilingual site. I have a page with the alias "about" in english. And english is my default language. So, when I am browsing the site in spanish I would like the spanish alias. I have tried all combinations I can think of to get the url() fucntion to translate "about" to "acercade",as it is in the system. What would be the correct way? Is it even working?

  url('about',array=("absolute"=>TRUE, "alias"=>TRUE)) ;

thats my best guess.

Thanks for any hint,
Michael


texts: How to make the node author's email show up as a replacement token in a Rules Action?

texts:
I have set up a rule that is as follows:

Rules Event: After saving new content of type Article.
Rules Conditions: User has role(s), with role = Authenticated user.
Rules Actions: Send mail to all users of a role, with role = Administrator.

When anyone adds an article to the site, all the admins are notified and I have used token replacements for the email fields like so:

Mail Subject: [node:author] has just created a piece of content entitled "[node:title]"
Message Body:

[node:author] has just created a piece of content entitled "[node:title]"

You can see the article here and proof read: [node:edit-url]

The article is here: [node:url]

This all works perfectly, however I want to also add the author of the node into this email so that any of the admins can email this person if they need to. I cannot work out how to get the author's email into the email body as it doesn't seem to show up in replacement patterns.

Anyone any idea how I can achieve this?


texts:
I want to setup Drush aliases for a Drupal site on WAMP. I tried, however I had no luck.

All my installations for Drupal sites are located in c:\wamp\www

Drush is located in c:\drush

I would not say I have multi site up!!

The URL I use in the browser is caribbean.localhost

I'm really not sure, or I have trouble setting up my Drush alias. So I wonder if anyone can advise me or offer direction help to me!


texts: How to add image & title to Podcast Feed dynamically

texts:
Using either View - RSS Fields / iTunes - (https://www.drupal.org/node/1473728) or FFPC module

I have a content type for a Podcast and a second content type for Episodes.  Episodes are related to the Podcast which has the Title & Art (images) associated with it.

The feed is mydomain.com/podcast/feed/[nodeid]

On our website, this "subscribe" link is auto-generated for clicking while viewing the Podcast node.  We're utilizing a contextual filter for the feed to populate properly.

The feed works from a technical point of view.  However, neither FFPC nor iTunes module appear to allow me to set the Title or Images dynamically.

Has anyone set something similar up where the Title, Image and potentially other fields are set dynamically during the feed generation rather than in a config panel Administratively.

Adding:
Content-Type Podcast
Title = Fred's Podcast
podcastImage = fres-square-image.jpg

Content-Type Podcast Episode
Title = Learning Drupal
mp3File = learning.mp3

Content-Type Podcast Episode
Title = RSS Feeds
mp3File = rssfeeds.mp3

View - Podcast Feeds
  Filter - Published & type-PodcastEpisode
  Contextual filter - Podcast Nid , using relationship Podcast
  Relationships - Entity Relationship, Podcast (identifier) - Referencing entity

The view/feed shows all Podcast Episodes for parent podcast based on NID.  The feed works fine, but I need to set the TITLE and IMAGE for the podcast to be the IMAGE and TITLE from the parent (NID) node content.  No problem if this is php code, just don't know where/how to inject.


texts:
I have a List (text) field on a comment type. This field is required and only one option may be chosen, so a radio button is how it will be rendered. I would now like to change the way the radio buttons are rendered to allow for additional necessary styling. I have never done this before.

Currently each element is styled as such:

  <input data-drupal-selector="edit-field-list-1" type="radio" id="edit-field-list-1" name="field_list" value="1" class="form-radio">
  Item #1

But, let's say that I wanted to add an HTML element inside this
 or move one around. I have created a module which adds a widget for this field type. Once this widget is selected, I have tried modifying the field using a number of different methods, but to no avail. I have been making sure to regularly clear the cache since I have been using the .module file and a template.

I've tried using a template file, radios.html.twig and adding it using various hooks, such as hook_theme_registry_alter() and hook_theme(). I've tried using hook_form_alter().

I have never modified the rendering of an element like this before and the documentation all seems to be different enough from what I am trying to do so as to only add confusion.

Could anyone please tell me how to accomplish this? I'm happy to add clarification as needed.

Additionally, is using a Field Widget the best way to accomplish this? It seems the correct way to me, since I only want it to affect the input element on the comment creation/edit form, but I'm open to being wrong.


texts:
Hi I have a problem with commerce checkout, which calculates wrong total prices.

My local dev site, which was created using commerce kickstarter 1.33, calculates the prices correctly including all taxes.
My demo site, on which I installed all modules manually, doens't add the taxes.

Since I exported all my tax configurations and some other componentes via features, the configuration should be the same, but maybe I'm missing a hidden configuration?

The problem seems to be, that the rules event "Calculating the sell price of a product" doesn't fire on my demo site, since it does fire on my dev site.

Commerce Kickstart doesn't seem to use any additional modules like Commerce price by components and I didn't install any other modules to my dev site either.

Has anyone experienced this odd behavior?


texts: Drupal page navigation with tab index for accessibility

texts:
I am tasked with the problem of making sure, that the page can be navigated by keyboard - mainly using the tab-key. I was wondering if there is a module or a certain way in Drupal to archive this since using JS to set the tabindex seems to be a very ugly solution which potentially could create chaos and slow down the page immensely.

Any hints or pointers are more than welcome.


texts: How to choose between Bean, Boxes and Fieldable Panels Panes?

texts:
Bean, Boxes and Fieldable Panels Panes all provide similar functionality. I have trouble understanding what exactly the differences between them are.

What are their advantages/disadvantages compared to each other? Are they geared towards different use cases?

I want to use some kind of blocks in Panels to add custom content - content editors also need to be able to add content, in that sense the blocks I need are not pure configuration. But I also use Features...

Edit: I'll add what seem to be the main differences

Boxes

Largest userbase (~ 11500)
Treats blocks as configuration (i.e. the content ends up in your features)
Modules offering integration

Beans

Has recently become popular, ~1000 installs
Treats blocks as content, but allows exportability of their configuration via machine name (e.g. via Bean Panels)
Modules offering integration

Fieldable Panels Panes

Smallest userbase (~ 400)
From the author of Panels/Views/etc.
Panes cannot be used as regular blocks in theme regions like beans or boxes (I assume)
I wonder what the advantages over Bean mentioned here are ("offers additional features that makes it easier to empower content admins to lay out certain pages")


texts: Is it possible to customize user profile URLs based on a custom profile field?

texts:
At the moment, my user profile URLs are changed in the standard way with pathauto, e.g.:

/users/user.name

However, I have different types of users (e.g. students, faculty, staff, etc.).

I would like the URL of each user's profile page to reflect that, e.g.:

example.org/students/user.name1
example.org/faculty/user.name2

The user type is set in a custom profile field: profile_user_type.

Is it possible to customize the URLs based on a profile field (in Drupal 6)?


texts:
I'm working on a Drupal 8 / Drupal Commerce website, and I run into "Website encountered unexpected error" when trying to access /admin/commerce/orders/* pages (order view page).

In log messages I get :

Error : Unsupported operand types dans Drupal\views\Element\View::preRenderViewElement() (/---/core/modules/views/src/Element/View.php ligne 49)
#0 [internal function]: Drupal\views\Element\View::preRenderViewElement(Array)
#1 /---/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array)
#2 /---/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false)
#...
#10 /---/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('commerce_order', Array)

So it seems that a view displayed on these pages causes this error. Does anyone ran into this error ?

Thanks

EDIT

After some debugging, I found that in

/core/modules/views/src/Element/View.php L49
$element += $view->element;

...$view is null, which causes the error. Above that line, $view is defined by this line (L43) :

$view = Views::getView($element['#name']);

...and $element['#name'] = commerce_order_item_table.

The View::getView() method is :

public static function getView($id) {
  $view = \Drupal::service('entity.manager')->getStorage('view')->load($id); // this call returns null
  if ($view) {
    return static::executableFactory()->get($view);
  }
}

So it seems that I miss a view (commerce_order_item_total) ?...
I'll report further info here.

EDIT 2

My missing view seems to be defined in

/modules/contrib/commerce/modules/order/config/install/views.view.commerce_order_item_table.yml

...but is not found apparently.

EDIT3

On /admin/config/development/configuration/single/export (exporting a single element), selectting "view" as configuration type, I cannot find "commerce_order_item_table". Doing a manual full export (drush cex --destination=sync) I don't find a views.view.commerce_order_item_table in sync folder.


texts: How to fix display problems with CKEditor?

texts:
I have installed CKEditor 3.6.0.6, I have enabled some buttons as in image:

CKEditor 3.6.0.6 in full size browser

However when I resize the browser smaller than the buttons zones, here is how is looking:

How can I brake CKEditor buttons to be displayed on multiple lines ? And why this behavior of CKEditor?

My browser Chrome 12.0.742.100. In Firefox 5 is the same problem.


texts: Programatically translated node shows original english content in edit mode

texts:
I have a requirement to add translation of a node programatically, and am running into a strange issue.
Below is the code I am using to add translation.
$node = node_load($nid);
$source_translation = $node->getTranslation($sourceLanguageKey);
$target_translation = $node->addTranslation($translationLanguageKey, $source_translation->toArray());

// Make sure we do not inherit the affected status from the source values.
if ($node->getEntityType()->isRevisionable()) {
    $target_translation->setRevisionTranslationAffected(NULL);
}

$entityManager = \Drupal::getContainer()->get('entity.manager');
$user = $entityManager->getStorage('user')->load(45986);

$translationManager = \Drupal::getContainer()->get('content_translation.manager');
$metadata = $translationManager->getTranslationMetadata($target_translation);
$metadata->setSource($sourceLanguageKey);
$node->save();

The script is not part of any modules and I have it placed under docroot directory.  I run it using the command drush scr myscript.php
The node itself has 2 languages: English (original), Korean.  I need to add a 3rd language: German and the content source should come from Korean.
Using the script above, I was able to add German translation with content pulled from Korean source.
However, the problem is when I visit the edit/new draft page of the added German translation node, it shows the English(Original) content, instead of Korean.  But the published content is Korean.
If I were to add the translation manually by hand, the translated German node is good and the edit/new draft page shows Korean content.  So, I know it is my script that is causing the issue but I am stuck in finding out what is missing and causing the problem.  Any advice would be helpful.
Note: Most of the code script was taken from the prepare translation function in the drupal api https://api.drupal.org/api/drupal/core%21modules%21content_translation%21src%21Controller%21ContentTranslationController.php/function/ContentTranslationController%3A%3AprepareTranslation/8.6.x and from this question: Create translated node programmatically


texts: Migrate Module and a constant Source file

texts:
In my Migrate module I have the path of the source file ( it's a CSV ) pointing to a file that exists on my server.  That part works great.  If I upload a file and rename it ( using the file browser module ) so that the uploaded file is the same name as the Migrate source file, I get some odd behavior.

The Migrate Import overview page doesn't complain that the file is missing, but the counts for the number of rows unimported are negative $x where $x is the number of rows imported ( from a previous run ).  So if I had imported 60 rows before, uploaded, and renamed the file, refreshed the import page, I see unimported is now -60.

Any ideas?


texts: Quiz Module persistance implementation details

texts:
In which part of the code is a new quiz stored in the database? What are the functions responsible for storing a new quiz in the database upon the submission of the form for creating a new quiz?

I'm trying to accomplish two things:

Timer per question
Dynamic question selection strategy

Quiz Module Version: 7.x-5.3


texts:
I am using D7. I want to sort the nodes by the comment post date on it.

Like

Node a created on Jan 03
Node b Created on Jan 05

Normally i can sort it either asc or desc.

What i want is a node with latest comment will be in top of my views.

I am looking for a views3 solution.
Is it possible ?


texts: How to keep "active" css on menu item when clicking on other link on same page?

texts:
I have an issue with my main menu.
When you click on the "Cases by Topic" menu item, you are taken to the "Cases by Topic" page. The "Cases by Topic" menu item is then given the css class "active". I set it up so if a menu item has "active" css it is dark blue, rather than light blue to indicate it is the current menu item.

The page it's self has a drupal block that has a bunch of taxonomy menu items. Each one of these taxonomy menu items also point to this page but will load a different set of information in the page (which is a drupal view).

When they click on a taxonomy link in the block it reloads the page, but then the "Cases by Topic" main menu item no longer has the "active" css class on it.

Here is a picture example:

The user clicks on the "Cases by Topic" main menu item and the page loads. At this point the "Cases by Topic" menu item has the 'active' css class.  The user then clicks on a taxonomy link in the drupal block ("Access to Information").

The same page reloads, but now the "active" css is on the taxonomy link and not the main menu "Cases by Topic" menu item.

I would really like to have the "active" css class stay on the "Cases by Topic" main menu item, even when people click the links in the taxonomy block.

At the very least I would not have the taxonomy link just clicked have "active" css and "Cases by Topic" should keep that css class.

Any ideas?


texts: What's wrong with the way I use variables in my function?

texts:
I have a function that looks like this:

function mymodule_privatemsg_message_validate($message) {
  $uid = $vars['message']->author->uid;

  //if root or help user, message should always go through regardless of length
  if ($uid !== '1') {
    if ($uid !== '3') {

      if (empty($message->thread_id) && strlen($message->body) < 200 ) {
    form_set_error('[body][value]', t('My custom message.'));
      }
    }
  }
}

However, I received a comment that "As side note, you are using $vars, but that variable has not been initialized from the function, nor is a function's parameter."  I don't understand what this means or what I'm doing wrong.  Could someone explain this to me?


texts: How to enable drag and drop picture upload into CKEditor?

texts:
I would like to include the functionality of drag & drop image uploading in CKEditor of my Drupal webpage.

I have been looking for information about that but I can't find anything useful, have you ever done it? I hope you can help me.


texts: Error when non-admin user attempts to create content

texts:
I have given authenticated users permission to create content but when linked to that page form a non-admin user, no fields are displayed and Drupal spits the following error:

"EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7818 of /Applications/MAMP/htdocs/nexuswipe/includes/common.inc)."


texts: Creating a relationship between taxonomy lists

texts:
I'm working on a website about cars, the question is quite simple, but probably, will need as much information as possible.

So here's the situation, I need to create several vocabularies that define a car, starting from a car maker, car model, year, engine, etc... what I need to do is put it in a form of sorts, that filters every section, so say I want Skoda, then in the model, it gives me Fabia/Octavia/Superb/etc... because definitely, A corvette has nothing to do with skoda!!!! then I choose Octavia, and the next list gives me years which it was in production, so it doesn't matter which year I choose the next one is Engine, which engines did it have at that year?

Lets put it in a Graph:

Skoda <- Octavia <- 2000 <- 1.6 8v <- etc...

How do I create the relationship? Do I really need to structure the taxonomy in a very complicated way or what do I do?! Help me, I'm clueless :'( Many websites do it, why is it so complicated on drupal?

Any help will be greatly appreciated!


texts:
I recently taken over a Drupal site to maintain and work on the design bit. I'm having an issue where if I enter a page on my site without the www prefix, I get directed to the front page. You should of course end up on the correct page anyway, maybe with the www prefix added.

I'm checking the .htaccess file and there i noticed this part:

 # If your site can be accessed both with and without the 'www.' prefix, you
 # can use one of the following settings to redirect users to your preferred
 # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
 #
 # To redirect all users to access the site WITH the 'www.' prefix,
 # (http://example.com/... will be redirected to http://www.example.com/...)
 # uncomment the following:
 RewriteCond %{HTTP_HOST} !^www\. [NC]
 RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 #
 # To redirect all users to access the site WITHOUT the 'www.' prefix,
 # (http://www.example.com/... will be redirected to http://example.com/...)
 # uncomment the following:
 # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
 # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

As you can see I did comment out the first two rows so I thought this would correct this issue, but no, I get no change at all. Anyone got any idea about what could be wrong?

I also noticed this lines, which mentions a index.php redirect. But I can't really understand if this causes my problem.

 # Pass all requests not referring directly to files in the filesystem to
 # index.php. Clean URLs are handled in drupal_environment_initialize().
 # RewriteCond %{REQUEST_FILENAME} !-f
 # RewriteCond %{REQUEST_FILENAME} !-d
 # RewriteCond %{REQUEST_URI} !=/favicon.ico
 # RewriteRule ^ index.php [L]

There seems to be no 404 page but every wrong adress get redirected to the front page.


texts: How to edit views twig template to process node information

texts:
I have created a views slider block in which have the following fields; image, title, text, and position. What I would like to do is look at the value of the position element and then add an css class to the title and text field to either display on the left or right side of the image.

In Drupal 7 I could do this very easily, but I can't figure out for the life of me how to do this in Drupal 8. I am overriding the views-view-fields.html.twig file.

Normally in Drupal 7 I would get the node ID, load it and then check the position value. In Drupal 8 using views-view-fields.html.twig file all I get is the rendered value (which contains html markup that I don't want).

Trying the preprocess route for the views-view-fields template file, I have the same problem in that value is already marked-up and no way to get the node that it came from.

If anyone has any suggestions how to go about accomplishing this, that would be fantastic.


texts:
I'm creating a module which adds a block.
In that block, I want users to be able to add as many (text) fields as they need. I know you can set up content-types to allow users to add as many fields as they need, but how can I implement this into a block module?

Long story short: is it possible to add a text field with an unlimited amount of fields to a block (module) the same way it can be done in content types?


texts: DB connection works from the CLI, but fails from within Drupal

texts:
I have set up a MySQL server on a machine with IP-address 192.0.2.9 (not the real address). The database user is named "drupal". Connecting to it using the CLI mysql command works just fine and the connection is accepted.

mysql -u drupal -p -h 192.0.2.9
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
...

However, when Drupal tries to connect to the same MySQL server from the same host, using the same credentials, I get this error:

PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '192.0.2.9' (9)
in lock_may_be_available() (line 167 of /var/www/html/includes/lock.inc).

I have double checked that the correct database credentials and host are set in settings.php. I am at my wit's end, unable to figure out why this database connection works from the CLI, but not from within Drupal.

In case it matters: This is Drupal 7.41 and the OS on both machines is RHEL7.


texts: How to comment out code in a .tpl.php template

texts:
If I want to remove parts of .tpl.php file what are my options other than removing them permanently?
HTML comments < !-- --> work but print the part in the HTML source.
PHP // comments or /* */ don't work.

For example, how could I comment out a block like:

    <?php if ($logo): ?>
      <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
      <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />

    <?php endif; ?>


texts: Passing a single two word value into contextual filter that allows multiple values

texts:
I have a contextual filter set up to allow multiple values, and it filters the view on the city. so if I pass in "new york", the view will look for "new,york" which will not return any results. If I pass in "new york,chattanooga" the view looks for "new york,chattanooga" which will give me the results from new york and chatanooga. Lastly, if I pass in "new york, "(notice the space), the view will give me the correct results.

Is there a way to get the view to not act this way? I.E. Allow me to do views_embed_view('places_to_stay', 'block', "new york");? Thanks!